[PATCH BlueZ] attrib: Fix memory leak on watcher exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux