[PATCH] OWE: Fix a possible memory leak

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Apr 3 05:16:15 PDT 2019


From: Ilan Peer <ilan.peer at intel.com>

Properly handle the case where OWE IE is allocated, but
there is no space left to add it in the WPA IE buffer.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 wpa_supplicant/wpa_supplicant.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 7c9f58105f..6833ec11d4 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2846,8 +2846,9 @@ static u8 * wpas_populate_assoc_ies(
 			os_memcpy(wpa_ie + wpa_ie_len,
 				  wpabuf_head(owe_ie), wpabuf_len(owe_ie));
 			wpa_ie_len += wpabuf_len(owe_ie);
-			wpabuf_free(owe_ie);
 		}
+
+		wpabuf_free(owe_ie);
 	}
 #endif /* CONFIG_OWE */
 
-- 
2.19.1




More information about the Hostap mailing list