From: Purushottam Kushwaha Date: Fri, 29 May 2015 09:20:41 +0000 (+0000) Subject: P2P: Fix a potential memory leak in a P2P+NFC corner case X-Git-Tag: hostap_2_5~689 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eda9d84dfdfad332213a708dcd7b7680078aeb66;p=thirdparty%2Fhostap.git 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 --- 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;