mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 17:48:40 +00:00
4260ca4b50b7216d18f7bed0857d781da3e3ba65
Clear LWIP callbacks (tcp_arg, tcp_recv, tcp_err) before calling tcp_close() or tcp_abort() to prevent use-after-free. After tcp_close(), the PCB remains alive during the TCP close handshake (FIN_WAIT, TIME_WAIT states). If LWIP calls recv/err callbacks during this period and the socket object has already been destroyed, the callback writes to freed memory, corrupting the heap. This was observed as umm_malloc_core crashes on ESP8266 during rapid API client connect/disconnect cycles — the heap free-list got corrupted by a dangling callback writing to a freed LWIPRawImpl object. Extract pcb_detach_abort() and pcb_detach_close() helpers to ensure all close/abort sites consistently clear callbacks first.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
614 MiB
Languages
C++
55.8%
Python
43.6%
C
0.3%
JavaScript
0.2%
