From cdcea1773a484767c766dccb63c32e0086d5bd4f Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 27 Aug 2015 17:45:27 +0300 Subject: [PATCH] audio/avrcp: Fix memory leak This frees settings list after used otherwise it leaks as follow: 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 152 of 239 at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E84679: g_malloc (in /usr/lib64/libglib-2.0.so.0.4400.1) by 0x4E9BCD2: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.4400.1) by 0x4E7A6E5: g_list_prepend (in /usr/lib64/libglib-2.0.so.0.4400.1) by 0x4E6E44B: g_hash_table_get_keys (in /usr/lib64/libglib-2.0.so.0.4400.1) by 0x426D5A: list_settings (media.c:1003) by 0x4336B4: player_list_settings (avrcp.c:1390) by 0x4336B4: avrcp_handle_register_notification (avrcp.c:1514) by 0x436711: handle_vendordep_pdu (avrcp.c:1827) by 0x42EB6F: session_cb (avctp.c:1025) by 0x4E7EA89: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4400.1) by 0x4E7EE1F: ??? (in /usr/lib64/libglib-2.0.so.0.4400.1) by 0x4E7F141: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4400.1) --- profiles/audio/avrcp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 2d76f5481..fd3504c77 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -1531,6 +1531,8 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session, pdu->params[len++] = val; } + g_list_free(settings); + break; case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED: len = 5; -- 2.47.3