From c9d9ee94e5a443ca11f9177cc8c532b0117bb204 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 14 Mar 2014 21:10:47 +0200 Subject: [PATCH] Fix hostapd_add_iface error path to deinit partially initialized BSS It was possible for the control interface and some of the BSS setup to be left partially initialized in failure cases while the BSS structures were still freed. Fix this by properly cleaning up anything that may have passed initialization successfully before freeing memory. Signed-off-by: Jouni Malinen --- src/ap/hostapd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 5833b828e..4ed718cf2 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1837,6 +1837,7 @@ int hostapd_add_iface(struct hapd_interfaces *interfaces, char *buf) if (start_ctrl_iface_bss(hapd) < 0 || (hapd_iface->state == HAPD_IFACE_ENABLED && hostapd_setup_bss(hapd, -1))) { + hostapd_cleanup(hapd); hapd_iface->bss[hapd_iface->num_bss - 1] = NULL; hapd_iface->conf->num_bss--; hapd_iface->num_bss--;