When removing all networks from a device, network->device pointers are
set to NULL even though the network is still referenced. This can lead
to segmentation faults when for example a service has several networks
and is being disconnected.
connman_element_unregister((struct connman_element *) network);
connman_network_unref(network);
-
- __connman_network_set_device(network, NULL);
}
static void device_destruct(struct connman_element *element)
{
const char *name;
+ if (device == NULL)
+ return;
+
if (device->network == network)
return;
connman_ipconfig_unref(network->ipconfig);
network->ipconfig = NULL;
}
+
+ network->device = NULL;
}
/**