Skip to contentSkip to conversation

watch: Free service data in service_reply

PATCH In review Zhenhua Zhang 2 participants 2 messages Jul 23, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watch: Free service data in service_reply

Avoid the memory leak of server_data.

---
 gdbus/watch.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
gdbus/watch.c +4 -1
index 1d479fa..ccdbb64 100644
@@ -468,8 +468,10 @@ static void service_reply(DBusPendingCall *call, void *user_data)
 	dbus_bool_t has_owner;
 
 	reply = dbus_pending_call_steal_reply(call);
-	if (reply == NULL)
+	if (reply == NULL) {
+		g_free(data);
 		return;
+	}
 
 	dbus_error_init(&error);
 
@@ -490,6 +492,7 @@ static void service_reply(DBusPendingCall *call, void *user_data)
 
 done:
 	dbus_message_unref(reply);
+	g_free(data);
 }
 
 static void check_service(DBusConnection *connection, const char *name,
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Zhenhua,

Quoted 4 lines

Avoid the memory leak of server_data.

---
 gdbus/watch.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

do me a favor and post this to linux-bluetooth(a)vger.kernel.org as well for the Bluetooth guys to review. After that I can take of applying it to all trees.

Regards

Marcel