OpenCloudOS-Kernel/tools/lib/perf
Ian Rogers 94725994cf 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 <irogers@google.com>
Reviewed-By: Kajol Jain <kjain@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220609052355.1300162-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-06-19 10:41:43 -03:00
..
Documentation libperf: Add API for allocating new thread map array 2022-02-23 14:40:23 -03:00
include libperf evsel: Add comments for booleans 2022-05-26 12:36:57 -03:00
tests libperf tests: Fix typo in perf_evlist__open() failure error messages 2022-03-26 10:55:57 -03:00
Build libperf: Change tests to single static and shared binaries 2021-07-07 11:41:58 -03:00
Makefile kbuild: replace $(if A,A,B) with $(or A,B) 2022-02-15 12:25:56 +09:00
core.c libperf: Move to tools/lib/perf 2020-01-06 11:46:09 -03:00
cpumap.c perf cpumap: More cpu map reuse by merge. 2022-04-01 16:19:35 -03:00
evlist.c perf tools: Allow system-wide events to keep their own threads 2022-05-26 12:36:57 -03:00
evsel.c libperf evsel: Open shouldn't leak fd on failure 2022-06-19 10:41:43 -03:00
internal.h libperf: Move to tools/lib/perf 2020-01-06 11:46:09 -03:00
lib.c libperf: Add preadn() 2022-05-23 10:11:12 -03:00
libperf.map libperf: Add API for allocating new thread map array 2022-02-23 14:40:23 -03:00
libperf.pc.template libperf: Move to tools/lib/perf 2020-01-06 11:46:09 -03:00
mmap.c libperf: Add arm64 support to perf_mmap__read_self() 2022-02-06 09:14:27 -03:00
threadmap.c libperf: Add API for allocating new thread map array 2022-02-23 14:40:23 -03:00
xyarray.c libperf: Move to tools/lib/perf 2020-01-06 11:46:09 -03:00