adhoc: segfault when exiting iwd after adhoc stop

adhoc_reset() destroys ssid and sta_states but leaves the pointers
around, athough the adhoc_state structure is not always freed.

This causes a segfault when exiting iwd after a client has done
adhoc start and adhoc stop on a device since adhoc_reset() is called
from adhoc_sta_free although it was previously called from
adhoc_leave_cb().
This commit is contained in:
Diego Santa Cruz 2020-04-07 23:33:47 +02:00 committed by Denis Kenzior
parent d66dcc9412
commit f5a7510a22
1 changed files with 2 additions and 0 deletions

View File

@ -131,10 +131,12 @@ static void adhoc_reset(struct adhoc_state *adhoc)
dbus_error_aborted(adhoc->pending));
l_free(adhoc->ssid);
adhoc->ssid = NULL;
netdev_station_watch_remove(adhoc->netdev, adhoc->sta_watch_id);
l_queue_destroy(adhoc->sta_states, adhoc_sta_free);
adhoc->sta_states = NULL;
adhoc->started = false;