From: Patrik Flykt <[email protected]>

When starting to scan, up the reference count on struct connman_device
and release it in the scan callback.
---
 plugins/wifi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index fa8eabd..e462639 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;
 }
-- 
1.7.2.5

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to