mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
perf inject: Close inject.output on exit
commit 02e6246f5364d5260a6ea6f92ab6f409058b162f upstream.
ASan reports a memory leak when running:
# perf test "83: Zstd perf.data compression/decompression"
which happens inside 'perf inject'.
The bug is caused by inject.output never being closed.
This patch adds the missing perf_data__close().
Signed-off-by: Riccardo Mancini <[email protected]>
Fixes: 6ef81c55a2 ("perf session: Return error code for perf_session__new() function on failure")
Cc: Ian Rogers <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mamatha Inamdar <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/c06f682afa964687367cf6e92a64ceb49aec76a5.1626343282.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
a9c103fa91
commit
f9d0c35556
1 changed files with 6 additions and 2 deletions
|
|
@ -836,8 +836,10 @@ int cmd_inject(int argc, const char **argv)
|
|||
|
||||
data.path = inject.input_name;
|
||||
inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool);
|
||||
if (IS_ERR(inject.session))
|
||||
return PTR_ERR(inject.session);
|
||||
if (IS_ERR(inject.session)) {
|
||||
ret = PTR_ERR(inject.session);
|
||||
goto out_close_output;
|
||||
}
|
||||
|
||||
if (zstd_init(&(inject.session->zstd_data), 0) < 0)
|
||||
pr_warning("Decompression initialization failed.\n");
|
||||
|
|
@ -874,5 +876,7 @@ int cmd_inject(int argc, const char **argv)
|
|||
out_delete:
|
||||
zstd_fini(&(inject.session->zstd_data));
|
||||
perf_session__delete(inject.session);
|
||||
out_close_output:
|
||||
perf_data__close(&inject.output);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue