Commit-ID: c4f035473d93c1594d8225f6dd97332317820801 Gitweb: http://git.kernel.org/tip/c4f035473d93c1594d8225f6dd97332317820801 Author: Wang Nan <wangnan0@xxxxxxxxxx> AuthorDate: Sun, 17 May 2015 10:56:27 +0000 Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> CommitDate: Mon, 18 May 2015 10:17:39 -0300 perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit Original vmlinux_path__exit() doesn't revert vmlinux_path__nr_entries to its original state. After the while loop vmlinux_path__nr_entries becomes -1 instead of 0. This makes a problem that, if runs twice, during the second run vmlinux_path__init() will set vmlinux_path[-1] to strdup("vmlinux"), corrupts random memory. This patch reset vmlinux_path__nr_entries to 0 after the while loop. Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx> Cc: Alexei Starovoitov <ast@xxxxxxxxxxxx Cc: Brendan Gregg <brendan.d.gregg@xxxxxxxxx> Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx> Cc: David Ahern <dsahern@xxxxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Cc: pi3orama@xxxxxxx Cc: Zefan Li <lizefan@xxxxxxxxxx> Link: http://lkml.kernel.org/r/1431860222-61636-3-git-send-email-wangnan0@xxxxxxxxxx Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> --- tools/perf/util/symbol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 9ef8b89..82a31fd 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1819,6 +1819,7 @@ static void vmlinux_path__exit(void) { while (--vmlinux_path__nr_entries >= 0) zfree(&vmlinux_path[vmlinux_path__nr_entries]); + vmlinux_path__nr_entries = 0; zfree(&vmlinux_path); } -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html