linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] android: Fix memory leak
@ 2014-08-15 10:30 Andrei Emeltchenko
  2014-08-15 11:03 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-08-15 10:30 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

protos gets allocated and needs to be freed
---
 android/bluetooth.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index d3a0c20..ba68e98 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1144,9 +1144,14 @@ static void find_remote_sdp_rec_cb(sdp_list_t *recs, int err,
 			goto done;
 		}
 
-		if (!sdp_get_access_protos(sdp_rec, &protos))
+		if (!sdp_get_access_protos(sdp_rec, &protos)) {
 			channel = sdp_get_proto_port(protos, L2CAP_UUID);
-		else
+
+			sdp_list_foreach(protos,
+						(sdp_list_func_t) sdp_list_free,
+						NULL);
+			sdp_list_free(protos, NULL);
+		} else
 			channel = -1;
 
 		if (channel < 0) {
-- 
1.9.1


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

* Re: [PATCH] android: Fix memory leak
  2014-08-15 10:30 [PATCH] android: Fix memory leak Andrei Emeltchenko
@ 2014-08-15 11:03 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2014-08-15 11:03 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

On Fri, Aug 15, 2014, Andrei Emeltchenko wrote:
> protos gets allocated and needs to be freed
> ---
>  android/bluetooth.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2014-08-15 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-15 10:30 [PATCH] android: Fix memory leak Andrei Emeltchenko
2014-08-15 11:03 ` Johan Hedberg

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