linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] audio: fix memory leak with typefinding
@ 2010-06-23 19:10 harri.mahonen
  2010-06-24  7:52 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: harri.mahonen @ 2010-06-23 19:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Harri Mahonen

From: Harri Mahonen <harri.mahonen@gmail.com>

sbc structure gets leaked each time when there is no data or SBC
syncword, because sbc_finalize is not called. Call sbc_init after
checking the data for syncword.

Signed-off-by: Harri Mahonen <harri.mahonen@gmail.com>
---
 audio/gstbluetooth.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/audio/gstbluetooth.c b/audio/gstbluetooth.c
index 26dd4a5..11aefd7 100644
--- a/audio/gstbluetooth.c
+++ b/audio/gstbluetooth.c
@@ -50,10 +50,10 @@ static void sbc_typefind(GstTypeFind *tf, gpointer ignore)
 	sbc_t sbc;
 	guint8 *data = gst_type_find_peek(tf, 0, 32);
 
-	if (sbc_init(&sbc, 0) < 0)
+	if (data == NULL || *data != 0x9c)	/* SBC syncword */
 		return;
 
-	if (data == NULL || *data != 0x9c)	/* SBC syncword */
+	if (sbc_init(&sbc, 0) < 0)
 		return;
 
 	aux = g_new(guint8, 32);
-- 
1.7.0.4


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

end of thread, other threads:[~2010-06-24 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 19:10 [PATCH] audio: fix memory leak with typefinding harri.mahonen
2010-06-24  7:52 ` Luiz Augusto von Dentz
2010-06-24  8:09   ` Luiz Augusto von Dentz
2010-06-24 14:36     ` Harri Mähönen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).