diff mbox series

OWE: Fix a possible memory leak

Message ID 20190403121615.4094-4-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series OWE: Fix a possible memory leak | expand

Commit Message

Andrei Otcheretianski April 3, 2019, 12:16 p.m. UTC
From: Ilan Peer <ilan.peer@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@intel.com>
---
 wpa_supplicant/wpa_supplicant.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jouni Malinen April 6, 2019, 3:50 p.m. UTC | #1
On Wed, Apr 03, 2019 at 03:16:15PM +0300, Andrei Otcheretianski wrote:
> Properly handle the case where OWE IE is allocated, but
> there is no space left to add it in the WPA IE buffer.

Thanks, applied.
diff mbox series

Patch

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 */