mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
When a loop is deleted while an internal legacy "cleanup" event is still queued (posted by a deferred self-unregistration from within a handler), esp_event_loop_delete() drained the queue but only freed the post payload, leaking the heap copy of the handler context allocated for the legacy path. Free ctx->handler_ctx for queued legacy cleanup events while draining the queue, mirroring the cleanup done in esp_event_loop_run(). Add a regression test that leaves a legacy cleanup event queued and asserts no memory is leaked on loop deletion.