summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-04-09 00:19:07 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-04-09 00:24:07 +0200
commit1163049a2c9d1306a470294245fce20d06965761 (patch)
tree96268d28ee2a7a872e77ed9ce069aebe910d7c18 /src/device.c
parent3291e6583f5bdb4fc6037cd33a357890127c3a1d (diff)
downloadconnman-1163049a2c9d1306a470294245fce20d06965761.tar.gz
connman-1163049a2c9d1306a470294245fce20d06965761.tar.bz2
connman-1163049a2c9d1306a470294245fce20d06965761.zip
Reset connman_network device pointer when it is no longer referenced
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.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index 2a8e7dab..75561c9f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -656,8 +656,6 @@ static void unregister_network(gpointer data)
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)
@@ -1468,6 +1466,9 @@ void __connman_device_set_network(struct connman_device *device,
{
const char *name;
+ if (device == NULL)
+ return;
+
if (device->network == network)
return;