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:
parent
fc68ece8d2
commit
97be0e87c3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue