On Mon, Mar 17, 2025 at 08:31:50PM -0700, Ian Rogers wrote: > Add missing btf__free in trace__exit. > > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx> > --- > tools/perf/builtin-trace.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c > index a5f31472980b..d4bbb6a1e817 100644 > --- a/tools/perf/builtin-trace.c > +++ b/tools/perf/builtin-trace.c > @@ -5339,6 +5339,12 @@ static void trace__exit(struct trace *trace) > zfree(&trace->syscalls.table); > } > zfree(&trace->perfconfig_events); > +#ifdef HAVE_LIBBPF_SUPPORT > + if (trace->btf != NULL) { No need for the check, btf__free() does: void btf__free(struct btf *btf) { if (IS_ERR_OR_NULL(btf)) return; Up to Namhyung to turn this into the simpler: btf__free(trace->btf); trace->btf = NULL; > + btf__free(trace->btf); > + trace->btf = NULL; > + } > +#endif > } > > #ifdef HAVE_BPF_SKEL > -- > 2.49.0.rc1.451.g8f38331e32-goog