[PATCH BlueZ 1/4] shared/gatt-server: Hold a reference to gatt-db.

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

 



Now that gatt-db is reference counted, gatt-server should hold a
reference to it.
---
 src/shared/gatt-server.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
index ef91289..3f3db56 100644
--- a/src/shared/gatt-server.c
+++ b/src/shared/gatt-server.c
@@ -129,6 +129,7 @@ static void bt_gatt_server_free(struct bt_gatt_server *server)
 
 	queue_destroy(server->prep_queue, prep_write_data_destroy);
 
+	gatt_db_unref(server->db);
 	bt_att_unref(server->att);
 	free(server);
 }
@@ -1177,14 +1178,14 @@ struct bt_gatt_server *bt_gatt_server_new(struct gatt_db *db,
 {
 	struct bt_gatt_server *server;
 
-	if (!att)
+	if (!att || !db)
 		return NULL;
 
 	server = new0(struct bt_gatt_server, 1);
 	if (!server)
 		return NULL;
 
-	server->db = db;
+	server->db = gatt_db_ref(db);
 	server->att = bt_att_ref(att);
 	server->mtu = MAX(mtu, BT_ATT_DEFAULT_LE_MTU);
 	server->max_prep_queue_len = DEFAULT_MAX_PREP_QUEUE_LEN;
-- 
2.2.0.rc0.207.ga3a616c

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