From: Haim Dreyfuss Date: Mon, 19 Jan 2015 01:44:39 +0000 (-0500) Subject: WNM: Fix possible memory leak by free buf X-Git-Tag: hostap_2_4~337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b62b0cb78a741cfe288feb97e4da540a7c872d00;p=thirdparty%2Fhostap.git WNM: Fix possible memory leak by free buf Buf is allocated and may not be freed on an error path. Signed-off-by: Haim Dreyfuss --- diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c index 7e8fb5c6d..4c8bc1008 100644 --- a/src/ap/wnm_ap.c +++ b/src/ap/wnm_ap.c @@ -564,8 +564,11 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, if (url) { /* Session Information URL */ url_len = os_strlen(url); - if (url_len > 255) + if (url_len > 255) { + os_free(buf); return -1; + } + *pos++ = url_len; os_memcpy(pos, url, url_len); pos += url_len;