From: Yasser Shalabi Date: Sat, 4 Oct 2014 15:37:57 +0000 (-0400) Subject: perf evlist: Fix for double free in tools/perf stat X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b2e19a934a36b2b4affcde9c170c0f01afabe50a;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git perf evlist: Fix for double free in tools/perf stat Fix for double free bug in tools/perf due to dangling thread_map pointer in perf_evlist struct. Code path excercised when perf stat -C switch is used but not set and is followed by another switch. Example: perf stat -C -e. Signed-off-by: Yasser Shalabi Acked-by: Namhyung Kim Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1412437077-13109-1-git-send-email-yassershalabi@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index b4b54d84e9b0..3c9e77d6b4c2 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -1003,6 +1003,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) out_delete_threads: thread_map__delete(evlist->threads); + evlist->threads = NULL; return -1; }