diff options
author | Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> | 2014-01-15 22:01:39 +0100 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-01-16 08:59:31 +0100 |
commit | c838bfcbb94bea99336007ed1d189eaa82d09352 (patch) | |
tree | 16f3622564b8abc4746999903b0a858b076081a5 | |
parent | 6bbd5c1736bc60b97b42618325f92fd7ba2f3e19 (diff) |
android/a2dp: Fix memory leak
audio_ipc_send_rsp_full() does not free buffer passed as parameter
thus it should be freed by caller.
This fixes following Valgrind report:
==1238== 5 bytes in 1 blocks are definitely lost in loss record 22 of 54
==1238== at 0x4896DC8: calloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==1238== by 0x48C5DB7: g_malloc0 (gmem.c:189)
==1238== by 0x1150EF: bt_stream_open (a2dp.c:1177)
==1238== by 0x1116A7: ipc_handle_msg (ipc.c:95)
==1238== by 0x111C11: audio_watch_cb (audio-ipc.c:66)
==1238== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166)
==1238== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539)
==1238== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146)
==1238== by 0x48C3167: g_main_loop_run (gmain.c:3340)
==1238== by 0x10B207: main (main.c:436)
-rw-r--r-- | android/a2dp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/android/a2dp.c b/android/a2dp.c index a5ea5a0d5..a36e9a3eb 100644 --- a/android/a2dp.c +++ b/android/a2dp.c @@ -1181,6 +1181,8 @@ static void bt_stream_open(const void *buf, uint16_t len) memcpy(rsp->preset->data, setup->preset->data, setup->preset->len); audio_ipc_send_rsp_full(AUDIO_OP_OPEN_STREAM, len, rsp, -1); + + g_free(rsp); } static void bt_stream_close(const void *buf, uint16_t len) |