]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fix interfaces.iface initialization
authorGuy Eilam <guy@wizery.com>
Fri, 15 Apr 2011 15:13:04 +0000 (18:13 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 15 Apr 2011 15:13:04 +0000 (18:13 +0300)
Set all the interfaces.iface pointers to NULL after the allocation of
that memory block for cases those pointers are accessed during each of
the interfaces initialization process (hostapd_interface_init()). One
example for such case is during WPS initialization when the code tries
to fetch the uuid from each of the interfaces.

Signed-off-by: Guy Eilam <guy@wizery.com>
hostapd/main.c

index c169375cf709690e0bffbc2ee8fa0af8cb9216f6..7a4cfb0041b02f90776cb978fa11edf3dafce1dc 100644 (file)
@@ -557,10 +557,10 @@ int main(int argc, char *argv[])
                wpa_debug_open_file(log_file);
 
        interfaces.count = argc - optind;
-       interfaces.iface = os_malloc(interfaces.count *
+       interfaces.iface = os_zalloc(interfaces.count *
                                     sizeof(struct hostapd_iface *));
        if (interfaces.iface == NULL) {
-               wpa_printf(MSG_ERROR, "malloc failed\n");
+               wpa_printf(MSG_ERROR, "malloc failed");
                return -1;
        }