aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-17 23:06:06 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-17 23:06:06 (GMT)
commitf0477201bd57cc509535a14f822d0ab5e1b1651c (patch)
tree0a11d7e4c0d008b000c61f1fb2a57c5a8fddd75b /wpa_supplicant
parent47f72245e2a574beede7b083c13ab6d30e05c31e (diff)
downloadhostap-06-f0477201bd57cc509535a14f822d0ab5e1b1651c.zip
hostap-06-f0477201bd57cc509535a14f822d0ab5e1b1651c.tar.gz
hostap-06-f0477201bd57cc509535a14f822d0ab5e1b1651c.tar.bz2
WPS: Fixed deinit code for freeing config and registrar data
We need to be a bit more careful when removing the WPS configuration block since wpa_s->current_ssid may still be pointing at it. In addition, registrar pointer in wps_context will need to be cleared since the context data is now maintained over multiple EAP-WSC runs. Without this, certain WPS operations could have used freed memory.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wps_supplicant.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index b3f4882..dcd0724 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -200,9 +200,11 @@ static void wpas_clear_wps(struct wpa_supplicant *wpa_s)
/* Remove any existing WPS network from configuration */
ssid = wpa_s->conf->ssid;
while (ssid) {
- if (ssid->key_mgmt & WPA_KEY_MGMT_WPS)
+ if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
+ if (ssid == wpa_s->current_ssid)
+ wpa_s->current_ssid = NULL;
id = ssid->id;
- else
+ } else
id = -1;
ssid = ssid->next;
if (id >= 0)