summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2011-09-06 10:13:17 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-12 12:14:16 +0200
commit8a0aef14616e3a3e1ca5ba9ba4295ebf95cf2899 (patch)
tree193575bfbd51c66aab99e59ffdf68422be540b92 /plugins
parent988a7a8d7c4bdc40e770f0a20f2da33e49386207 (diff)
downloadconnman-8a0aef14616e3a3e1ca5ba9ba4295ebf95cf2899.tar.gz
connman-8a0aef14616e3a3e1ca5ba9ba4295ebf95cf2899.tar.bz2
connman-8a0aef14616e3a3e1ca5ba9ba4295ebf95cf2899.zip
wifi: Device reference counting fix on scan
When starting to scan, up the reference count on struct connman_device and release it in the scan callback.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wifi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c
index ee305861..db87f01d 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -279,6 +279,7 @@ static void scan_callback(int result, GSupplicantInterface *interface,
connman_device_reset_scanning(device);
else
connman_device_set_scanning(device, FALSE);
+ connman_device_unref(device);
}
static int wifi_scan(struct connman_device *device)
@@ -291,10 +292,13 @@ static int wifi_scan(struct connman_device *device)
if (wifi->tethering == TRUE)
return 0;
+ connman_device_ref(device);
ret = g_supplicant_interface_scan(wifi->interface, scan_callback,
device);
if (ret == 0)
connman_device_set_scanning(device, TRUE);
+ else
+ connman_device_unref(device);
return ret;
}