summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArman Uguray <armansito@chromium.org>2014-12-03 11:32:25 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-12-03 23:15:49 +0200
commit042cbc7c7003535b43c8f9f88bca3587ab1f974f (patch)
treeccc1cdee7cf66b368fd43492a78ab8021c0b0769 /src
parent7f5766984cb91e85ec526670fc8794067970f617 (diff)
downloadbluez-042cbc7c7003535b43c8f9f88bca3587ab1f974f.tar.gz
shared/gatt-server: Hold a reference to gatt-db
Now that gatt-db is reference counted, gatt-server should hold a reference to it.
Diffstat (limited to 'src')
-rw-r--r--src/shared/gatt-server.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
index ef912899d..3f3db5643 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;