Sashiko wrote:
> - [Medium] Memory leak of a newly created `VAR_REF` hist_field when
> `init_var_ref()` fails in `create_var_ref()`.

Confirmed, and it predates this patch.

The call that leaks was correct when 067fe038e70f ("tracing: Add variable
reference handling to hist triggers") added it, since destroy_hist_field()
freed var refs unconditionally then. It became a leak with 656fe2ba85e8
("tracing: Use hist trigger's var_ref array to destroy var_refs"), which
made destroy_hist_field() return early for HIST_FIELD_FL_VAR_REF while
create_var_ref() still reaches var_refs[] only after init_var_ref() has
succeeded.

Fix posted separately:
https://lore.kernel.org/linux-trace-kernel/[email protected]/

Reply via email to