Fix hostapd error path regression

Commit 354c903f8e added setting of
driver_ap_teardown on the hostapd exit path without taking into account
that this may also be called on an error path where the interface has
not been initialized. Fix the resulting NULL pointer dereference to
allow hostapd to exit cleanly in error case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-03-07 22:37:03 +02:00 committed by Jouni Malinen
parent c16a7590cf
commit 49021c1cb6

View file

@ -729,6 +729,8 @@ int main(int argc, char *argv[])
hostapd_global_ctrl_iface_deinit(&interfaces); hostapd_global_ctrl_iface_deinit(&interfaces);
/* Deinitialize all interfaces */ /* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++) { for (i = 0; i < interfaces.count; i++) {
if (!interfaces.iface[i])
continue;
interfaces.iface[i]->driver_ap_teardown = interfaces.iface[i]->driver_ap_teardown =
!!(interfaces.iface[i]->drv_flags & !!(interfaces.iface[i]->drv_flags &
WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT); WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT);