Diff between 006213cf4d231ce66de273e96619474bd516359b and 35803206af73a041c04481dfac0c9e1feac5e561

Changed Files

File Additions Deletions Status
src/device.c +4 -3 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index 9736bb6..fb9c0e7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -225,6 +225,7 @@ struct btd_device {
 	 * attribute cache support can be built.
 	 */
 	struct gatt_db *db;			/* GATT db cache */
+	unsigned int db_id;
 	struct bt_gatt_client *client;		/* GATT client instance */
 	struct bt_gatt_server *server;		/* GATT server instance */
 	unsigned int gatt_ready_id;
@@ -644,7 +645,7 @@ static void device_free(gpointer user_data)
 	g_slist_free_full(device->svc_callbacks, svc_dev_remove);
 
 	/* Reset callbacks since the device is going to be freed */
-	gatt_db_register(device->db, NULL, NULL, NULL, NULL);
+	gatt_db_unregister(device->db, device->db_id);
 
 	attio_cleanup(device);
 
@@ -3666,8 +3667,8 @@ static struct btd_device *device_new(struct btd_adapter *adapter,
 	device->adapter = adapter;
 	device->temporary = true;
 
-	gatt_db_register(device->db, gatt_service_added, gatt_service_removed,
-								device, NULL);
+	device->db_id = gatt_db_register(device->db, gatt_service_added,
+					gatt_service_removed, device, NULL);
 
 	return btd_device_ref(device);
 }