- stop_autoscan() should unref the device only when relevant, i.e. when
interval and/or timeout have been set.
- autoscan_scan_callback() should unref the device since it has been
referenced in throw_wifi_scan()
autoscan = wifi->autoscan;
- if (autoscan->timeout > 0)
- g_source_remove(autoscan->timeout);
+ if (autoscan->timeout == 0 && autoscan->interval == 0)
+ return;
+
+ g_source_remove(autoscan->timeout);
autoscan->timeout = 0;
autoscan->interval = 0;
DBG("");
connman_device_set_scanning(device, FALSE);
+ connman_device_unref(device);
}
static gboolean autoscan_timeout(gpointer data)