gatt: Fix attempting to create device on disconnection
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 2 Oct 2018 08:18:31 +0000 (11:18 +0300)
committerhimanshu <h.himanshu@samsung.com>
Tue, 14 Jan 2020 08:53:35 +0000 (14:23 +0530)
If ATT is disconnected and the state points to an invalid device it
must have been destroyed in the meantime and should not be recreated.

Change-Id: I60d5bafb0130188ce718b38a02e8008b151a5750
Signed-off-by: himanshu <h.himanshu@samsung.com>
src/gatt-database.c

index b57ed5c..af71844 100644 (file)
@@ -339,8 +339,8 @@ static void att_disconnected(int err, void *user_data)
 
        state->disc_id = 0;
 
-       device = btd_adapter_get_device(state->db->adapter, &state->bdaddr,
-                                       state->bdaddr_type);
+       device = btd_adapter_find_device(state->db->adapter, &state->bdaddr,
+                                                       state->bdaddr_type);
        if (!device)
                goto remove;