summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-03-18 22:07:40 -0700
committerNamhyung Kim <namhyung@kernel.org>2025-03-20 22:58:31 -0700
commit874fa827df50a9e1d258c7539e51cd945cc4a34d (patch)
tree476c21ca6307854e8001deacd6bf28afe57c94b3 /tools
parentccc60dce3e2d0dfcee0b3666d9e2d95ef001ea1f (diff)
perf trace: Fix BTF memory leak
Add missing btf__free in trace__exit. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Arnaldo Carvalho de Melo <acme@kernel.org> Link: https://lore.kernel.org/r/20250319050741.269828-14-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-trace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a5f31472980b..1d4ad5d19b10 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -5339,6 +5339,10 @@ static void trace__exit(struct trace *trace)
zfree(&trace->syscalls.table);
}
zfree(&trace->perfconfig_events);
+#ifdef HAVE_LIBBPF_SUPPORT
+ btf__free(trace->btf);
+ trace->btf = NULL;
+#endif
}
#ifdef HAVE_BPF_SKEL