watcher_free() will be automatically called when removing the D-Bus watch (it was set as the destroy callback when adding the watch), therefore it is only necessary to remove the watch. --- attrib/client.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/attrib/client.c b/attrib/client.c index f1c26c4..b5282c2 100644 --- a/attrib/client.c +++ b/attrib/client.c @@ -227,6 +227,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); + g_dbus_remove_watch(gatt->conn, watcher->id); remove_attio(gatt); } @@ -429,10 +430,8 @@ static DBusMessage *unregister_watcher(DBusConnection *conn, return btd_error_not_authorized(msg); watcher = l->data; - g_dbus_remove_watch(conn, watcher->id); gatt->watchers = g_slist_remove(gatt->watchers, watcher); - watcher_free(watcher); - + g_dbus_remove_watch(conn, watcher->id); remove_attio(gatt); return dbus_message_new_method_return(msg); -- 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