summaryrefslogtreecommitdiff
path: root/plugins/bluetooth.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-07-25 16:24:34 +0200
committerMarcel Holtmann <marcel@holtmann.org>2011-07-26 01:22:38 +0200
commit52c76529ae6f1aca786111e9343b75d5535097c1 (patch)
tree90a7553584c37078a3be41eb28d58e4e4034b22b /plugins/bluetooth.c
parent61e8631af19a43d4fb307c197c00bb467671b11b (diff)
downloadconnman-52c76529ae6f1aca786111e9343b75d5535097c1.tar.gz
bluetooth: Unref network objects
The bluetooth plugin creates the network object therefore it should also unref (destroy) it.
Diffstat (limited to 'plugins/bluetooth.c')
-rw-r--r--plugins/bluetooth.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 65a9d5d3..39833a04 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -571,8 +571,6 @@ static gboolean device_removed(DBusConnection *connection,
g_hash_table_remove(bluetooth_networks, network_path);
- connman_device_remove_network(device, network);
-
return TRUE;
}
@@ -787,6 +785,20 @@ static void unregister_device(gpointer data)
connman_device_unref(device);
}
+static void remove_network(gpointer data)
+{
+ struct connman_network *network = data;
+ struct connman_device *device;
+
+ DBG("network %p", network);
+
+ device = connman_network_get_device(network);
+ if (device != NULL)
+ connman_device_remove_network(device, network);
+
+ connman_network_unref(network);
+}
+
static void bluetooth_connect(DBusConnection *connection, void *user_data)
{
DBusMessage *message;
@@ -798,7 +810,7 @@ static void bluetooth_connect(DBusConnection *connection, void *user_data)
g_free, unregister_device);
bluetooth_networks = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, NULL);
+ g_free, remove_network);
message = dbus_message_new_method_call(BLUEZ_SERVICE, "/",
BLUEZ_MANAGER_INTERFACE, LIST_ADAPTERS);