mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
a4f0b098bc
cluster::destroy() freed the cluster memory and its children (attributes, commands, events) but never removed the cluster from the parent endpoint's linked list, leaving a dangling pointer. This caused use-after-free crashes when creating a new cluster on the same endpoint after destroying one. Fix: look up the parent endpoint via the endpoint_id stored in the cluster struct and unlink before freeing, consistent with how attribute::destroy, command::destroy and event::destroy handle their parent lists.