Skip to contentSkip to conversation

AVDTP: Fix memory leak

PATCH Applied Luiz Augusto von Dentz 2 participants 2 messages Feb 1, 2013 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 AVDTP: Fix memory leak

From: Luiz Augusto von Dentz <[email protected]>

56 (16 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 173 of 263
at 0x4A0883C: malloc (vg_replace_malloc.c:270)
by 0x4C8568E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3400.2)
by 0x4C9A7F1: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3400.2)
by 0x4C9BB92: g_slist_append (in /usr/lib64/libglib-2.0.so.0.3400.2)
by 0x422072: send_req (avdtp.c:2569)
by 0x422D0B: avdtp_discover (avdtp.c:3380)
by 0x41D16C: source_setup_stream (source.c:307)
by 0x41D1EF: source_connect (source.c:331)
by 0x465411: connect_next (device.c:1073)
by 0x466C92: device_profile_connected (device.c:1097)
by 0x4629EB: ext_connect (profile.c:950)
by 0x44AECB: connect_cb (btio.c:230)

---
 profiles/audio/avdtp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
profiles/audio/avdtp.c +5 -1
index 0187691..403a22b 100644
@@ -599,8 +599,10 @@ static gboolean avdtp_send(struct avdtp *session, uint8_t transaction,
 	return TRUE;
 }
 
-static void pending_req_free(struct pending_req *req)
+static void pending_req_free(void *data)
 {
+	struct pending_req *req = data;
+
 	if (req->timeout)
 		g_source_remove(req->timeout);
 	g_free(req->data);
@@ -1137,6 +1139,8 @@ static void avdtp_free(void *data)
 	if (session->req)
 		pending_req_free(session->req);
 
+	g_slist_free_full(session->req_queue, pending_req_free);
+	g_slist_free_full(session->prio_queue, pending_req_free);
 	g_slist_free_full(session->seps, sep_free);
 
 	g_free(session->buf);
Signature · 1 line
1.8.1
#1 lore raw

Hi Luiz,

Quoted 13 lines · Luiz Augusto von Dentz

56 (16 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 173 of 263
at 0x4A0883C: malloc (vg_replace_malloc.c:270)
by 0x4C8568E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3400.2)
by 0x4C9A7F1: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3400.2)
by 0x4C9BB92: g_slist_append (in /usr/lib64/libglib-2.0.so.0.3400.2)
by 0x422072: send_req (avdtp.c:2569)
by 0x422D0B: avdtp_discover (avdtp.c:3380)
by 0x41D16C: source_setup_stream (source.c:307)
by 0x41D1EF: source_connect (source.c:331)
by 0x465411: connect_next (device.c:1073)
by 0x466C92: device_profile_connected (device.c:1097)
by 0x4629EB: ext_connect (profile.c:950)
by 0x44AECB: connect_cb (btio.c:230)

Quoted 3 lines
---
 profiles/audio/avdtp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied. Thanks.

Johan