perf values: Fix allocation check
Bailing out in case the allocation failed, not the other way round.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170824162737.7813-8-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index 9ac36bf..2c4af02 100644
--- a/tools/perf/util/values.c
+++ b/tools/perf/util/values.c
@@ -131,7 +131,7 @@
for (i = 0; i < values->threads; i++) {
u64 *value = realloc(values->value[i], counters_max * sizeof(**values->value));
- if (value) {
+ if (!value) {
pr_debug("failed to enlarge read_values ->values array");
goto out_free_name;
}