From: Jiri Olsa Date: Fri, 20 Jun 2014 08:56:34 +0000 (+0200) Subject: perf tools: Fix wrong condition for allocation failure X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d180ac14a95d738c2d2622db82c2212a8f998200;p=linux-beck.git perf tools: Fix wrong condition for allocation failure Check real allocated pointer for NULL. Cc: Arnaldo Carvalho de Melo Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/n/tip-5rfzbalwjphmdzzil74eazyl@git.kernel.org Signed-off-by: Jiri Olsa --- diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 65a151e36067..3e80aa10cfd8 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -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;