scan: Fix crash

Sometimes the periodic scan is started and stopped before the timeout
was created.  If periodic_scan_stop was called before, the timeout
object was not reset to NULL, which can lead to a crash.
This commit is contained in:
Denis Kenzior 2016-04-13 16:03:33 -05:00
parent fc68ece8d2
commit 97be0e87c3
1 changed files with 5 additions and 1 deletions

View File

@ -487,7 +487,11 @@ bool scan_periodic_stop(uint32_t ifindex)
l_debug("Stopping periodic scan for ifindex: %u", ifindex);
l_timeout_remove(sc->sp.timeout);
if (sc->sp.timeout) {
l_timeout_remove(sc->sp.timeout);
sc->sp.timeout = NULL;
}
sc->sp.interval = 0;
sc->sp.callback = NULL;
sc->sp.userdata = NULL;