Fix memory leak on EAPOL Authenticator error path
authorMasashi Honma <honma@ictec.co.jp>
Tue, 23 Nov 2010 23:42:50 +0000 (01:42 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 23 Nov 2010 23:42:50 +0000 (01:42 +0200)
wlan0: RADIUS No authentication server configured
MEMLEAK[0x999feb8]: len 1040
WPA_TRACE: memleak - START
[3]: ./hostapd(radius_msg_new+0x33) [0x8074f43]
     radius_msg_new() ../src/radius/radius.c:117
[4]: ./hostapd() [0x806095e]
     ieee802_1x_encapsulate_radius() ../src/ap/ieee802_1x.c:439
     ieee802_1x_aaa_send() ../src/ap/ieee802_1x.c:1496

For example, this error occured when I used WPS hostapd without
"eap_server=1" definition in configuration file.

src/ap/ieee802_1x.c

index 0c86017..35bb187 100644 (file)
@@ -551,7 +551,9 @@ static void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd,
                }
        }
 
-       radius_client_send(hapd->radius, msg, RADIUS_AUTH, sta->addr);
+       if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, sta->addr) < 0)
+               goto fail;
+
        return;
 
  fail: