The destroy callback of the hash table (device->networks)
will unref and unregister the network object.
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;