linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] device: Fix memory leak in load_att_info()
@ 2012-12-14  9:43 Frédéric Danis
  2012-12-14 11:20 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Frédéric Danis @ 2012-12-14  9:43 UTC (permalink / raw)
  To: linux-bluetooth

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


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

* Re: [PATCH] device: Fix memory leak in load_att_info()
  2012-12-14  9:43 [PATCH] device: Fix memory leak in load_att_info() Frédéric Danis
@ 2012-12-14 11:20 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-12-14 11:20 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth

Hi Frederic,

On Fri, Dec 14, 2012, Frédéric Danis wrote:
> ---
>  src/device.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2012-12-14 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-14  9:43 [PATCH] device: Fix memory leak in load_att_info() Frédéric Danis
2012-12-14 11:20 ` 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).