Merge branch 'bugfix/eloop_mem_leak_v5.4' into 'release/v5.4'

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

See merge request espressif/esp-idf!45904
This commit is contained in:
Jiang Jiang Jian
2026-02-28 11:44:55 +08:00
2 changed files with 8 additions and 2 deletions

View File

@@ -500,7 +500,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);

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) {