perf tools: Fix wrong condition for allocation failure
authorJiri Olsa <jolsa@kernel.org>
Fri, 20 Jun 2014 08:56:34 +0000 (10:56 +0200)
committerJiri Olsa <jolsa@kernel.org>
Fri, 27 Jun 2014 09:14:54 +0000 (11:14 +0200)
Check real allocated pointer for NULL.

Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-5rfzbalwjphmdzzil74eazyl@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
tools/perf/builtin-stat.c

index 65a151e360679bca4fbbd346adb550de5e0d5653..3e80aa10cfd8d717c37850a23abade2321f134a4 100644 (file)
@@ -184,7 +184,7 @@ static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
 {
        evsel->priv = zalloc(sizeof(struct perf_stat));
-       if (evsel == NULL)
+       if (evsel->priv == NULL)
                return -ENOMEM;
        perf_evsel__reset_stat_priv(evsel);
        return 0;