device: Fix a inbalance of ref/unref of network objects
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 25 Jul 2011 14:24:27 +0000 (16:24 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 25 Jul 2011 23:19:59 +0000 (01:19 +0200)
The destroy callback of the hash table (device->networks)
will unref and unregister the network object.

src/device.c

index 9008269..1465fce 100644 (file)
@@ -1138,15 +1138,12 @@ void __connman_device_set_network(struct connman_device *device,
        if (device->network == network)
                return;
 
-       if (device->network != NULL)
-               connman_network_unref(device->network);
-
        if (network != NULL) {
                name = connman_network_get_string(network, "Name");
                g_free(device->last_network);
                device->last_network = g_strdup(name);
 
-               device->network = connman_network_ref(network);
+               device->network = network;
        } else {
                g_free(device->last_network);
                device->last_network = NULL;