After g_hash_table_remove(device->networks, identifier); the previously
cached service pointer can be invalid.
Bug reported by: Daniel Wagner <daniel.wagner@bmw-carit.de>
service = __connman_service_lookup_from_network(network);
identifier = connman_network_get_identifier(network);
- g_hash_table_remove(device->networks, identifier);
+ g_hash_table_steal(device->networks, identifier);
if (service != NULL)
__connman_service_reset_from_networks(service, device->networks);
+ free_network(network);
+
return 0;
}