diff options
author | Ian Rogers <[email protected]> | 2022-06-08 22:23:52 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-06-19 10:41:43 -0300 |
commit | 94725994cfd768b9ee1bd06f15c252694b1e9b89 (patch) | |
tree | 32c9114c24945da99f6225d1209a1c16120f4304 /tools/testing/selftests/bpf/prog_tests/autoload.c | |
parent | ec906102e5b7d3393cfe83e606b48cf0c1fcb122 (diff) |
libperf evsel: Open shouldn't leak fd on failure
If perf_event_open() fails the fd is opened but it is only freed by
closing (not by delete).
Typically when an open fails you don't call close and so this results in
a memory leak. To avoid this, add a close when open fails.
Signed-off-by: Ian Rogers <[email protected]>
Reviewed-By: Kajol Jain <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Anshuman Khandual <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/autoload.c')
0 files changed, 0 insertions, 0 deletions