From fb306e968c0fc7a621df09c2c544db895d0b3419 Mon Sep 17 00:00:00 2001 From: Vinicius Gomes Date: Mon, 14 Apr 2008 21:10:27 +0000 Subject: hcid: removing device object when some error occurs during bonding process --- hcid/adapter.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'hcid/adapter.c') diff --git a/hcid/adapter.c b/hcid/adapter.c index cd75e6c9..47dbed1d 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -2442,6 +2442,19 @@ struct device *adapter_get_device(DBusConnection *conn, return adapter_create_device(conn, adapter, address); } +void remove_pending_device(struct adapter *adapter) +{ + struct device *device; + char address[18]; + + ba2str(&adapter->bonding->bdaddr, address); + device = adapter_find_device(adapter, address); + if (!device) + return; + + adapter_remove_device(adapter->bonding->conn, adapter, device); +} + static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond, struct adapter *adapter) { @@ -2561,6 +2574,7 @@ static gboolean create_bonding_conn_complete(GIOChannel *io, GIOCondition cond, failed: g_io_channel_close(io); + remove_pending_device(adapter); cleanup: name_listener_remove(adapter->bonding->conn, -- cgit