diff options
| author | Zhongqiu Han <[email protected]> | 2024-12-05 08:44:59 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2024-12-10 19:59:32 +0000 |
| commit | a7da6c7030e1aec32f0a41c7b4fa70ec96042019 (patch) | |
| tree | 3b25b136d3a9d8fdb89a5f44640b5f357220dffb /tools/perf/util/env.h | |
| parent | perf header: Fix one memory leakage in process_bpf_btf() (diff) | |
| download | kernel-a7da6c7030e1aec32f0a41c7b4fa70ec96042019.tar.gz kernel-a7da6c7030e1aec32f0a41c7b4fa70ec96042019.zip | |
perf header: Fix one memory leakage in process_bpf_prog_info()
Function __perf_env__insert_bpf_prog_info() will return without inserting
bpf prog info node into perf env again due to a duplicate bpf prog info
node insertion, causing the temporary info_linear and info_node memory to
leak. Modify the return type of this function to bool and add a check to
ensure the memory is freed if the function returns false.
Fixes: 606f972b1361f477 ("perf bpf: Save bpf_prog_info information as headers to perf.data")
Reviewed-by: Namhyung Kim <[email protected]>
Signed-off-by: Zhongqiu Han <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Yicong Yang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/env.h')
| -rw-r--r-- | tools/perf/util/env.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h index ae604c4edbb7..9db2e5a625ed 100644 --- a/tools/perf/util/env.h +++ b/tools/perf/util/env.h @@ -176,7 +176,7 @@ const char *perf_env__raw_arch(struct perf_env *env); int perf_env__nr_cpus_avail(struct perf_env *env); void perf_env__init(struct perf_env *env); -void __perf_env__insert_bpf_prog_info(struct perf_env *env, +bool __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info_node *info_node); void perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info_node *info_node); |
