Fork of espressif/esp_websocket_client v1.7.0 carrying two use-after-free fixes for cross-task TLS teardown:
-
Sender-side abort deferral — a failed send from any task other than the websocket task no longer calls
esp_transport_close()directly (the websocket task polls the transport withclient->lockreleased, so a close from a sender frees the TLS context under a concurrentesp_transport_poll_read()). Senders setpending_abort; the websocket task performs the abort at the top of its locked loop, so the transport is only ever closed from the task that uses it. -
Destroy-from-own-task guard —
esp_websocket_client_destroy()previously ignoredstop_wait_task()failing (which happens when called from the websocket task itself) and freed the transport/TLS context under the still-running task, which then reconnected through freed memory. It now refuses withESP_FAIL; useesp_websocket_client_destroy_on_exit()from the websocket task instead.
Both defects manifest as PSRAM heap-poisoning corruption with
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y (mbedtls contexts in SPIRAM).
The esp-websocket_client component is a managed component for esp-idf that contains implementation of WebSocket protocol client for ESP32
Get started with example test example:
- View the full html documentation