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 <p.kushwaha@samsung.com>
This commit is contained in:
Purushottam Kushwaha 2015-05-29 09:20:41 +00:00 committed by Jouni Malinen
parent 701d9729b3
commit eda9d84dfd

View file

@ -1187,6 +1187,7 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
} }
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) { 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); ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
if (ssid->ssid) { if (ssid->ssid) {
ssid->ssid_len = wpa_s->go_params->ssid_len; ssid->ssid_len = wpa_s->go_params->ssid_len;