Skip to contentSkip to conversation

perf tools: Fix wrong condition for allocation failure

tip:perf/core tip-bot for Jiri Olsa 1 participant 1 message Jul 5, 2014 perf events

lore
Share & tools
lore

tip-bot for Jiri Olsa

author merge bot
#0 lore raw
Commit-ID:  d180ac14a95d738c2d2622db82c2212a8f998200
Gitweb:     http://git.kernel.org/tip/d180ac14a95d738c2d2622db82c2212a8f998200
Author:     Jiri Olsa <[email protected]>
AuthorDate: Fri, 20 Jun 2014 10:56:34 +0200
Committer:  Jiri Olsa <[email protected]>
CommitDate: Fri, 27 Jun 2014 11:14:54 +0200

perf tools: Fix wrong condition for allocation failure

Check real allocated pointer for NULL.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/builtin-stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-stat.c +1 -1
index 65a151e..3e80aa1 100644
@@ -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;