mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-17 17:43:06 -05:00
hostapd: Fix memory leak on dynamic add-BSS error path
If "ADD bss_config=" command failed in driver_init() or hostapd_setup_interface(), some of the allocated resources were not freed properly. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
3f63614f18
commit
71f1d1e54d
@ -1940,11 +1940,19 @@ int hostapd_add_iface(struct hapd_interfaces *interfaces, char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (new_iface) {
|
if (new_iface) {
|
||||||
if (interfaces->driver_init(hapd_iface) ||
|
if (interfaces->driver_init(hapd_iface)) {
|
||||||
hostapd_setup_interface(hapd_iface)) {
|
|
||||||
interfaces->count--;
|
interfaces->count--;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hostapd_setup_interface(hapd_iface)) {
|
||||||
|
interfaces->count--;
|
||||||
|
hostapd_deinit_driver(
|
||||||
|
hapd_iface->bss[0]->driver,
|
||||||
|
hapd_iface->bss[0]->drv_priv,
|
||||||
|
hapd_iface);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Assign new BSS with bss[0]'s driver info */
|
/* Assign new BSS with bss[0]'s driver info */
|
||||||
hapd = hapd_iface->bss[hapd_iface->num_bss - 1];
|
hapd = hapd_iface->bss[hapd_iface->num_bss - 1];
|
||||||
@ -2036,14 +2044,14 @@ fail:
|
|||||||
wpa_printf(MSG_DEBUG, "%s: free hapd %p (%s)",
|
wpa_printf(MSG_DEBUG, "%s: free hapd %p (%s)",
|
||||||
__func__, hapd_iface->bss[i],
|
__func__, hapd_iface->bss[i],
|
||||||
hapd->conf->iface);
|
hapd->conf->iface);
|
||||||
|
hostapd_cleanup(hapd);
|
||||||
os_free(hapd);
|
os_free(hapd);
|
||||||
hapd_iface->bss[i] = NULL;
|
hapd_iface->bss[i] = NULL;
|
||||||
}
|
}
|
||||||
os_free(hapd_iface->bss);
|
os_free(hapd_iface->bss);
|
||||||
|
hapd_iface->bss = NULL;
|
||||||
}
|
}
|
||||||
wpa_printf(MSG_DEBUG, "%s: free iface %p",
|
hostapd_cleanup_iface(hapd_iface);
|
||||||
__func__, hapd_iface);
|
|
||||||
os_free(hapd_iface);
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user