From: Jouni Malinen Date: Fri, 7 Mar 2014 20:37:03 +0000 (+0200) Subject: Fix hostapd error path regression X-Git-Tag: hostap_2_2~648 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49021c1cb62456d5ec4eec4b2e2431c0b8c0890b;p=thirdparty%2Fhostap.git Fix hostapd error path regression Commit 354c903f8e47ae0fb41fb54ecc018e61d9573506 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 --- diff --git a/hostapd/main.c b/hostapd/main.c index 68bc9b582..a9d7da511 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -729,6 +729,8 @@ int main(int argc, char *argv[]) hostapd_global_ctrl_iface_deinit(&interfaces); /* Deinitialize all interfaces */ for (i = 0; i < interfaces.count; i++) { + if (!interfaces.iface[i]) + continue; interfaces.iface[i]->driver_ap_teardown = !!(interfaces.iface[i]->drv_flags & WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT);