From a789e6a2f6ef43fa6773a9a1160483f9afb4e146 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 2 Oct 2014 12:08:13 +0300 Subject: [PATCH] shared/gatt-client: Fix gatt_client_init This function is only called within bt_gatt_client_new therefore it is not possible to have a ready callback and should return false if bt_gatt_exchange_mtu fails. --- src/shared/gatt-client.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index ddedaf031..5833e7a84 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -1005,10 +1005,8 @@ static bool gatt_client_init(struct bt_gatt_client *client, uint16_t mtu) exchange_mtu_cb, discovery_op_ref(op), discovery_op_unref)) { - if (client->ready_callback) - client->ready_callback(false, 0, client->ready_data); - free(op); + return false; } client->in_init = true; @@ -1269,7 +1267,8 @@ struct bt_gatt_client *bt_gatt_client_new(struct bt_att *att, uint16_t mtu) client->att = bt_att_ref(att); - gatt_client_init(client, mtu); + if (!gatt_client_init(client, mtu)) + goto fail; return bt_gatt_client_ref(client); -- 2.47.3