fix(wpa_supplicant): Fix location of clearing up dpp global variables

- Fix location of cleaing up dpp global variables to ensure that there are
  no concurrency issues.
This commit is contained in:
jgujarathi 2023-11-21 12:12:32 +05:30
parent 30c510020f
commit 76da067bce

View File

@ -22,7 +22,6 @@ static void *s_dpp_evt_queue = NULL;
static void *s_dpp_api_lock = NULL;
static bool s_dpp_listen_in_progress;
static int s_dpp_auth_retries;
static struct esp_dpp_context_t s_dpp_ctx;
static wifi_action_rx_cb_t s_action_rx_cb = esp_supp_rx_action;
@ -362,6 +361,16 @@ static void esp_dpp_task(void *pvParameters )
switch (evt->id) {
case SIG_DPP_DEL_TASK:
struct dpp_bootstrap_params_t *params = &s_dpp_ctx.bootstrap_params;
if (params->info) {
os_free(params->info);
params->info = NULL;
}
if (s_dpp_ctx.dpp_global) {
dpp_global_deinit(s_dpp_ctx.dpp_global);
s_dpp_ctx.dpp_global = NULL;
}
if (s_dpp_ctx.dpp_auth) {
dpp_auth_deinit(s_dpp_ctx.dpp_auth);
s_dpp_ctx.dpp_auth = NULL;
@ -689,21 +698,15 @@ esp_err_t esp_supp_dpp_init(esp_supp_dpp_event_cb_t cb)
void esp_supp_dpp_deinit(void)
{
struct dpp_bootstrap_params_t *params = &s_dpp_ctx.bootstrap_params;
if (params->info) {
os_free(params->info);
params->info = NULL;
}
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_ACTION_TX_STATUS,
&offchan_event_handler);
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_ROC_DONE,
&offchan_event_handler);
s_dpp_auth_retries = 0;
if (s_dpp_ctx.dpp_global) {
dpp_global_deinit(s_dpp_ctx.dpp_global);
s_dpp_ctx.dpp_global = NULL;
esp_dpp_post_evt(SIG_DPP_DEL_TASK, 0);
if (esp_dpp_post_evt(SIG_DPP_DEL_TASK, 0)) {
wpa_printf(MSG_ERROR, "DPP Deinit Failed");
}
}
}
#endif