[PATCH 08/15] perf evlist: Fix for double free in tools/perf stat

From: Arnaldo Carvalho de Melo
Date: Wed Oct 15 2014 - 16:53:38 EST


From: Yasser Shalabi <yassershalabi@xxxxxxxxx>

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 <yassershalabi@xxxxxxxxx>
Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Link: http://lkml.kernel.org/r/1412437077-13109-1-git-send-email-yassershalabi@xxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/evlist.c | 1 +
1 file changed, 1 insertion(+)

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;
}

--
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/