From acd17f476e4aba09becc325d1562f6c8db5e24ec Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 7 Oct 2008 10:52:25 +0200 Subject: Check for NULL return of adapter_find_device In theory the device might have been removed if the D-Bus client exited before the remote side accepted the pairing. This is just a short term fix since security.c is still storing the link key. In the long run we should move the link key storing to dbus-hci.c and only do it when we get auth complete or connect complete. --- src/dbus-hci.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/dbus-hci.c') diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 4ba5e129..2ae307e8 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -1101,6 +1101,10 @@ void hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer) ba2str(peer, peer_addr); device = adapter_find_device(adapter, peer_addr); + if (!device) { + error("link_key_notify: device %s was removed!", peer_addr); + return; + } bonding = adapter_get_bonding_info(adapter); -- cgit