ER code may still touch WPS registrar/context during deinit, so better
do that before freeing the other WPS components.
if (wpa_s->wps == NULL)
return;
+#ifdef CONFIG_WPS_ER
+ wps_er_deinit(wpa_s->wps_er);
+ wpa_s->wps_er = NULL;
+#endif /* CONFIG_WPS_ER */
+
wps_registrar_deinit(wpa_s->wps->registrar);
wpabuf_free(wpa_s->wps->dh_pubkey);
wpabuf_free(wpa_s->wps->dh_privkey);
os_free(wpa_s->wps->network_key);
os_free(wpa_s->wps);
wpa_s->wps = NULL;
-
-#ifdef CONFIG_WPS_ER
- wps_er_deinit(wpa_s->wps_er);
- wpa_s->wps_er = NULL;
-#endif /* CONFIG_WPS_ER */
}