fix(esp_wifi): Fix memory leak caused due to eloop

- Fix memory leak when eloop timer is in eloop queue and esp_wifi_deinit is
called
- Return error on long timeout
- Fix memory leak when register timeout returns error
This commit is contained in:
Shreyas Sheth
2025-10-27 17:08:18 +05:30
committed by BOT
parent a483acbf8f
commit 63487a51ab
3 changed files with 12 additions and 3 deletions
@@ -740,7 +740,10 @@ static int esp_supp_rx_action(uint8_t *hdr, uint8_t *payload, size_t len, uint8_
rx_param->frm_len = len;
os_memcpy(rx_param->action_frm, payload, len);
eloop_register_timeout(0, 0, esp_dpp_rx_action, rx_param, NULL);
if (eloop_register_timeout(0, 0, esp_dpp_rx_action, rx_param, NULL) != 0) {
os_free(rx_param);
return ESP_ERR_NO_MEM;
}
}
return ret;
@@ -545,7 +545,10 @@ bool wpa_ap_remove(u8* bssid)
return false;
}
os_memcpy(addr, sta->addr, ETH_ALEN);
eloop_register_timeout(0, 10000, ap_free_sta_timeout, hapd, addr);
if (eloop_register_timeout(0, 10000, ap_free_sta_timeout, hapd, addr) != 0) {
os_free(addr);
return false;
}
} else
#endif
ap_free_sta(hapd, sta);
+4 -1
View File
@@ -169,7 +169,7 @@ overflow:
"ELOOP: Too long timeout (secs=%u usecs=%u) to ever happen - ignore it",
secs, usecs);
os_free(timeout);
return 0;
return -1;
}
#ifdef ELOOP_DEBUG
@@ -526,6 +526,9 @@ void eloop_destroy(void)
sec, usec, timeout->eloop_data, timeout->user_data,
timeout->handler);
#endif
if (timeout->handler) {
timeout->handler(timeout->eloop_data, timeout->user_data);
}
eloop_remove_timeout(timeout);
}
if (eloop_data_lock) {