All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hfp: Fix memory leak when listing bluetooth devices
@ 2010-02-05 23:06 Vinicius Costa Gomes
  2010-02-05 23:30 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2010-02-05 23:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]

---
 plugins/hfp.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/plugins/hfp.c b/plugins/hfp.c
index fe7b78b..f235253 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -547,7 +547,7 @@ static void parse_get_properties(DBusMessage *reply, const char *device)
 static void get_properties_cb(DBusPendingCall *call, gpointer user_data)
 {
 	DBusMessage *reply;
-	const char *device = user_data;
+	char *device = user_data;
 
 	reply = dbus_pending_call_steal_reply(call);
 
@@ -567,6 +567,7 @@ static void get_properties_cb(DBusPendingCall *call, gpointer user_data)
 	parse_get_properties(reply, device);
 
 done:
+	g_free(device);
 	dbus_message_unref(reply);
 }
 
@@ -574,7 +575,7 @@ static void list_devices_cb(DBusPendingCall *call, gpointer user_data)
 {
 	DBusError err;
 	DBusMessage *reply;
-	const char **device = NULL;
+	char **device = NULL;
 	int num, ret, i;
 
 	reply = dbus_pending_call_steal_reply(call);
@@ -607,11 +608,14 @@ static void list_devices_cb(DBusPendingCall *call, gpointer user_data)
 				BLUEZ_DEVICE_INTERFACE, "GetProperties",
 				get_properties_cb, (void *)device[i],
 				DBUS_TYPE_INVALID);
-		if (ret < 0)
+		if (ret < 0) {
+			g_free(device[i]);
 			ofono_error("GetProperties failed(%d)", ret);
+		}
 	}
 
 done:
+	g_free(device);
 	dbus_message_unref(reply);
 }
 
-- 
1.6.6.1


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

* Re: [PATCH] hfp: Fix memory leak when listing bluetooth devices
  2010-02-05 23:06 [PATCH] hfp: Fix memory leak when listing bluetooth devices Vinicius Costa Gomes
@ 2010-02-05 23:30 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2010-02-05 23:30 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

Hi Vinicius,

> ---
>  plugins/hfp.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 

Patch has been applied.  Thanks.

Regards,
-Denis

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

end of thread, other threads:[~2010-02-05 23:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-05 23:06 [PATCH] hfp: Fix memory leak when listing bluetooth devices Vinicius Costa Gomes
2010-02-05 23:30 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.