perf stat: fix NULL pointer reference bug with event unit
authorStephane Eranian <eranian@google.com>
Fri, 17 Jan 2014 15:34:05 +0000 (16:34 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 20 Jan 2014 19:19:08 +0000 (16:19 -0300)
commit8a398897ff21f73cb8b15a19514660f032926882
treebb08e1fcfe48e09b30ec21f67b7b7fbb5fb7f176
parent3a46817f674389d5fb2f4dce19fbc73ebd1976bb
perf stat: fix NULL pointer reference bug with event unit

This patch fixes a problem with the handling of the newly introduced
optional event unit. The following cmdline caused a segfault:

 $ perf stat -e cpu/event-0x3c/ ls

This patch fixes the problem with the default setting for alias->unit
which was eventually causing the segfault.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1389972846-6566-2-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/parse-events.c
tools/perf/util/pmu.c
tools/perf/util/pmu.h