diff options
-rw-r--r-- | src/adapter.c | 10 | ||||
-rw-r--r-- | src/adapter.h | 2 | ||||
-rw-r--r-- | src/dbus-hci.c | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/adapter.c b/src/adapter.c index dd5a6762..b58ba49a 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2918,6 +2918,16 @@ void adapter_add_active_conn(struct adapter *adapter, bdaddr_t *bdaddr, adapter->active_conn = g_slist_append(adapter->active_conn, dev); } +void adapter_remove_active_conn(struct adapter *adapter, + struct active_conn_info *dev) +{ + if (!adapter || !adapter->active_conn) + return; + + adapter->active_conn = g_slist_remove(adapter->active_conn, dev); + g_free(dev); +} + int btd_register_adapter_driver(struct btd_adapter_driver *driver) { adapter_drivers = g_slist_append(adapter_drivers, driver); diff --git a/src/adapter.h b/src/adapter.h index 9374654e..e0653f2d 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -177,6 +177,8 @@ void adapter_mode_changed(struct adapter *adapter, uint8_t scan_mode); struct agent *adapter_get_agent(struct adapter *adapter); void adapter_add_active_conn(struct adapter *adapter, bdaddr_t *bdaddr, uint16_t handle); +void adapter_remove_active_conn(struct adapter *adapter, + struct active_conn_info *dev); struct btd_adapter_driver { const char *name; diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 79cb8d30..665cf621 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -1193,8 +1193,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status, adapter->bonding = NULL; } - adapter->active_conn = g_slist_remove(adapter->active_conn, dev); - g_free(dev); + adapter_remove_active_conn(adapter, dev); device = adapter_find_device(adapter, paddr); if (device) { |