From: Ian Rogers <irog...@google.com>

[ Upstream commit 4599d292128d89e4cf866a0ea9a9b047a2de8418 ]

Memory leaks found by applying LLVM's libfuzzer on the tools/perf
parse_events function.

Signed-off-by: Ian Rogers <irog...@google.com>
Cc: Adrian Hunter <adrian.hun...@intel.com>
Cc: Alexander Shishkin <alexander.shish...@linux.intel.com>
Cc: Andi Kleen <a...@linux.intel.com>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Leo Yan <leo....@linaro.org>
Cc: Mark Rutland <mark.rutl...@arm.com>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Stephane Eranian <eran...@google.com>
Cc: clang-built-li...@googlegroups.com
Link: http://lore.kernel.org/lkml/20200319023101.82458-2-irog...@google.com
[ Did a minor adjustment due to some other previous patch having already set 
evlist->all_cpus to NULL at perf_evlist__exit() ]
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 tools/lib/perf/evlist.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
index 5b9f2ca50591..62130d28652d 100644
--- a/tools/lib/perf/evlist.c
+++ b/tools/lib/perf/evlist.c
@@ -125,6 +125,7 @@ static void perf_evlist__purge(struct perf_evlist *evlist)
 void perf_evlist__exit(struct perf_evlist *evlist)
 {
        perf_cpu_map__put(evlist->cpus);
+       perf_cpu_map__put(evlist->all_cpus);
        perf_thread_map__put(evlist->threads);
        evlist->cpus = NULL;
        evlist->threads = NULL;
-- 
2.25.1



Reply via email to