From: Jouni Malinen Date: Fri, 14 Mar 2014 19:10:47 +0000 (+0200) Subject: Fix hostapd_add_iface error path to deinit partially initialized BSS X-Git-Tag: hostap_2_2~549 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9d9ee94e5a443ca11f9177cc8c532b0117bb204;p=thirdparty%2Fhostap.git 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 --- 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--;