diff --git a/emulator/btdev.c b/emulator/btdev.c
index ec52c52..77d44ad 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
{
struct btdev_conn *conn;
- while ((conn = queue_find(dev->conns, match_handle,
- UINT_TO_PTR(handle))))
+ while (queue_find(dev->conns, match_handle, UINT_TO_PTR(handle)))
handle++;
conn = new0(struct btdev_conn, 1);
cc.encr_mode = 0x00;
done:
- pending_conn_del(dev, conn->link->dev);
-
send_event(dev, BT_HCI_EVT_CONN_COMPLETE, &cc, sizeof(cc));
return 0;
{
struct bt_hci_evt_auth_complete ev;
+ if (!conn)
+ return;
+
memset(&ev, 0, sizeof(ev));
- ev.handle = conn ? cpu_to_le16(conn->handle) : 0x0000;
+ ev.handle = cpu_to_le16(conn->handle);
ev.status = status;
send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));