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 f7ed3bf394
commit 1a040ee357
2 changed files with 8 additions and 2 deletions
@@ -498,7 +498,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
@@ -156,7 +156,7 @@ overflow:
"ELOOP: Too long timeout (secs=%u usecs=%u) to ever happen - ignore it",
secs, usecs);
os_free(timeout);
return 0;
return -1;
}
static bool timeout_exists(struct eloop_timeout *old)
@@ -398,6 +398,9 @@ void eloop_destroy(void)
"eloop_data=%p user_data=%p handler=%p",
sec, usec, timeout->eloop_data, timeout->user_data,
timeout->handler);
if (timeout->handler) {
timeout->handler(timeout->eloop_data, timeout->user_data);
}
eloop_remove_timeout(timeout);
}
if (eloop_data_lock) {