[PATCH] device: Fix memory leak in load_att_info()

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

 



---
 src/device.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index 7bde970..bb0db30 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1903,15 +1903,18 @@ static void load_att_info(struct btd_device *device, const gchar *local,
 	groups = g_key_file_get_groups(key_file, NULL);
 
 	for (handle = groups; *handle; handle++) {
+		gboolean uuid_ok;
+
 		str = g_key_file_get_string(key_file, *handle, "UUID", NULL);
 		if (!str)
 			continue;
 
-		if (!g_str_equal(str, prim_uuid))
-			continue;
-
+		uuid_ok = g_str_equal(str, prim_uuid);
 		g_free(str);
 
+		if (!uuid_ok)
+			continue;
+
 		str = g_key_file_get_string(key_file, *handle, "Value", NULL);
 		if (!str)
 			continue;
@@ -1938,6 +1941,8 @@ static void load_att_info(struct btd_device *device, const gchar *local,
 			}
 			break;
 		default:
+			g_free(str);
+			g_free(prim);
 			continue;
 		}
 
-- 
1.7.9.5

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