Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] AVDTP: Fix memory leak
@ 2013-02-01 18:20 Luiz Augusto von Dentz
  2013-02-01 21:23 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-02-01 18:20 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 0187691..403a22b 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -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);
-- 
1.8.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-01 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-01 18:20 [PATCH BlueZ] AVDTP: Fix memory leak Luiz Augusto von Dentz
2013-02-01 21:23 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox