Fix ConnMan crash while disable wifi device
authorMohamed Abbas <mohamed.abbas@intel.com>
Wed, 22 Sep 2010 10:25:09 +0000 (12:25 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 22 Sep 2010 13:39:48 +0000 (15:39 +0200)
When calling unregister_network() ConnMan sets the network->device pointer
to NULL. That is fine with ESSIDs formed by 1 AP. Otherwise, the eventual
call to __connman_device_decrease_connections() leads to a crash as the
device pointer is NULL.

Fixes BMC #6772

src/device.c

index 6a9bce6..ad976b5 100644 (file)
@@ -1371,11 +1371,17 @@ int __connman_device_set_offlinemode(connman_bool_t offlinemode)
 
 void __connman_device_increase_connections(struct connman_device *device)
 {
+       if (device == NULL)
+               return;
+
        device->connections++;
 }
 
 void __connman_device_decrease_connections(struct connman_device *device)
 {
+       if (device == NULL)
+               return;
+
        device->connections--;
 }