From f5a7510a2206d8d0fa521f1e72c514535b10c8b6 Mon Sep 17 00:00:00 2001 From: Diego Santa Cruz Date: Tue, 7 Apr 2020 23:33:47 +0200 Subject: [PATCH] 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(). --- src/adhoc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/adhoc.c b/src/adhoc.c index 328433ca..8c61f81e 100644 --- a/src/adhoc.c +++ b/src/adhoc.c @@ -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;