diff options
author | Ian Rogers <[email protected]> | 2021-08-26 11:48:33 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2021-08-31 15:12:00 -0300 |
commit | 298105b78b0ede160c2b94293b86d4ba4e936ad5 (patch) | |
tree | 8878e79d96963835d9d4385f55d46bd67b6bd1c4 | |
parent | 760f5e77e662e0141bd46ade28d72fc884ca64d9 (diff) |
perf bpf: Fix memory leaks relating to BTF.
BTF needs to be freed with btf__free().
Signed-off-by: Ian Rogers <[email protected]>
Reviewed-by: Kajol Jain <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/util/bpf-event.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index d43f6b5e5169..0bae061b2d6d 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1833,7 +1833,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, ret = 0; out: free(prog_linfo); - free(btf); + btf__free(btf); fclose(s); bfd_close(bfdf); return ret; diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index cdecda1ddd36..17a9844e4fbf 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -296,7 +296,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, out: free(info_linear); - free(btf); + btf__free(btf); return err ? -1 : 0; } @@ -486,7 +486,7 @@ static void perf_env__add_bpf_info(struct perf_env *env, u32 id) perf_env__fetch_btf(env, btf_id, btf); out: - free(btf); + btf__free(btf); close(fd); } |