diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 5301ed715..884acf6c8 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1926,6 +1926,22 @@ void wpa_config_free_cred(struct wpa_cred *cred) } +void wpa_config_flush_blobs(struct wpa_config *config) +{ +#ifndef CONFIG_NO_CONFIG_BLOBS + struct wpa_config_blob *blob, *prev; + + blob = config->blobs; + config->blobs = NULL; + while (blob) { + prev = blob; + blob = blob->next; + wpa_config_free_blob(prev); + } +#endif /* CONFIG_NO_CONFIG_BLOBS */ +} + + /** * wpa_config_free - Free configuration data * @config: Configuration data from wpa_config_read() @@ -1935,9 +1951,6 @@ void wpa_config_free_cred(struct wpa_cred *cred) */ void wpa_config_free(struct wpa_config *config) { -#ifndef CONFIG_NO_CONFIG_BLOBS - struct wpa_config_blob *blob, *prevblob; -#endif /* CONFIG_NO_CONFIG_BLOBS */ struct wpa_ssid *ssid, *prev = NULL; struct wpa_cred *cred, *cprev; @@ -1955,15 +1968,7 @@ void wpa_config_free(struct wpa_config *config) wpa_config_free_cred(cprev); } -#ifndef CONFIG_NO_CONFIG_BLOBS - blob = config->blobs; - prevblob = NULL; - while (blob) { - prevblob = blob; - blob = blob->next; - wpa_config_free_blob(prevblob); - } -#endif /* CONFIG_NO_CONFIG_BLOBS */ + wpa_config_flush_blobs(config); wpabuf_free(config->wps_vendor_ext_m1); os_free(config->ctrl_interface); diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index e24772d11..a98a5aa53 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -979,6 +979,7 @@ void wpa_config_set_blob(struct wpa_config *config, struct wpa_config_blob *blob); void wpa_config_free_blob(struct wpa_config_blob *blob); int wpa_config_remove_blob(struct wpa_config *config, const char *name); +void wpa_config_flush_blobs(struct wpa_config *config); struct wpa_cred * wpa_config_get_cred(struct wpa_config *config, int id); struct wpa_cred * wpa_config_add_cred(struct wpa_config *config); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 32941aedd..b4dcb39c5 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5296,6 +5296,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->extra_blacklist_count = 0; wpa_supplicant_ctrl_iface_remove_network(wpa_s, "all"); wpa_supplicant_ctrl_iface_remove_cred(wpa_s, "all"); + wpa_config_flush_blobs(wpa_s->conf); wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME, 43200); wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_REAUTH_THRESHOLD, 70);