linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] attrib: Fix memory leak on watcher exit
@ 2012-03-08 20:01 Anderson Lizardo
  2012-03-08 23:53 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Anderson Lizardo @ 2012-03-08 20:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

The "destroy" callback of g_dbus_add_disconnect_watch() is actually
never called, therefore the watcher data should be freed on
watcher_exit().
---
 attrib/client.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index 60cff01..e6cd3dc 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -212,6 +212,7 @@ static void watcher_exit(DBusConnection *conn, void *user_data)
 	DBG("%s watcher %s exited", gatt->path, watcher->name);
 
 	gatt->watchers = g_slist_remove(gatt->watchers, watcher);
+	watcher_free(watcher);
 }
 
 static int characteristic_set_value(struct characteristic *chr,
@@ -355,7 +356,7 @@ static DBusMessage *register_watcher(DBusConnection *conn,
 	watcher->gatt = gatt;
 	watcher->path = g_strdup(path);
 	watcher->id = g_dbus_add_disconnect_watch(conn, sender, watcher_exit,
-							watcher, watcher_free);
+								watcher, NULL);
 
 	if (gatt->attioid == 0)
 		gatt->attioid = btd_device_add_attio_callback(gatt->dev,
-- 
1.7.5.4


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

end of thread, other threads:[~2012-03-14 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08 20:01 [PATCH BlueZ] attrib: Fix memory leak on watcher exit Anderson Lizardo
2012-03-08 23:53 ` Johan Hedberg
2012-03-09  2:32   ` Anderson Lizardo
2012-03-14 14:45     ` Anderson Lizardo

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