aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2014-06-20 04:56:34 -0400
committerJiri Olsa <jolsa@kernel.org>2014-06-27 05:14:54 -0400
commitd180ac14a95d738c2d2622db82c2212a8f998200 (patch)
treed104c58fa7bc765298481d9f323fa56c3a6332a3
parenta60335ba32981db5bc057b35782644e9e2436407 (diff)
perf tools: Fix wrong condition for allocation failure
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>
-rw-r--r--tools/perf/builtin-stat.c2
1 files changed, 1 insertions, 1 deletions
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)
184static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) 184static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
185{ 185{
186 evsel->priv = zalloc(sizeof(struct perf_stat)); 186 evsel->priv = zalloc(sizeof(struct perf_stat));
187 if (evsel == NULL) 187 if (evsel->priv == NULL)
188 return -ENOMEM; 188 return -ENOMEM;
189 perf_evsel__reset_stat_priv(evsel); 189 perf_evsel__reset_stat_priv(evsel);
190 return 0; 190 return 0;