[PATCH] android: Fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux