[PATCH] perf: fix for double free in tools/perf stat

From: Yasser Shalabi
Date: Sat Oct 04 2014 - 12:38:16 EST


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>

---
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 814e954..09af633 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -845,6 +845,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)

out_delete_threads:
thread_map__delete(evlist->threads);
+ evlist->threads = 0;
return -1;
}

--
1.7.10.4

--
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/