From 49021c1cb62456d5ec4eec4b2e2431c0b8c0890b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 7 Mar 2014 22:37:03 +0200 Subject: [PATCH] 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 --- hostapd/main.c | 2 ++ 1 file changed, 2 insertions(+) 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);