Diff between 7ed42033406158d18b7e9c376de45f2babf19f05 and a789e6a2f6ef43fa6773a9a1160483f9afb4e146

Changed Files

File Additions Deletions Status
src/shared/gatt-client.c +3 -4 modified

Full Patch

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index ddedaf0..5833e7a 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);