From eda9d84dfdfad332213a708dcd7b7680078aeb66 Mon Sep 17 00:00:00 2001
From: Purushottam Kushwaha
Date: Fri, 29 May 2015 09:20:41 +0000
Subject: [PATCH] P2P: Fix a potential memory leak in a P2P+NFC corner case
Avoid memory leak due to previous allocation for ssid->ssid. It does not
look like this is hit in normal cases, but at might be possible for the
SSID to get set if the peer is present in previous scan results and WPS
code ends up copying the SSID from there.
Signed-off-by: Purushottam Kushwaha
---
wpa_supplicant/wps_supplicant.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 8a5cb8e8f..61a85876b 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1187,6 +1187,7 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
}
#ifdef CONFIG_P2P
if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
+ os_free(ssid->ssid);
ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
if (ssid->ssid) {
ssid->ssid_len = wpa_s->go_params->ssid_len;