From a0289e5d69bca0db8c2c8f6df144092739c94f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Fri, 14 Dec 2012 10:43:22 +0100 Subject: [PATCH] device: Fix memory leak in load_att_info() --- src/device.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index 87ea0ed16..01c40a72e 100644 --- a/src/device.c +++ b/src/device.c @@ -1906,15 +1906,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; @@ -1941,6 +1944,8 @@ static void load_att_info(struct btd_device *device, const gchar *local, } break; default: + g_free(str); + g_free(prim); continue; } -- 2.47.3