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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-03-14 21:10:47 +02:00 committed by Jouni Malinen
parent 6829da39e6
commit c9d9ee94e5
1 changed files with 1 additions and 0 deletions

View File

@ -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--;