summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/values.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2017-08-24 18:27:34 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-08-28 21:44:43 +0200
commitf4ef3b7c184c4c269f953f226f7158347d007622 (patch)
tree78291f6aea342310a15826b002483c19fc976039 /tools/perf/util/values.c
parentperf values: Fix thread index bug (diff)
downloadlinux-f4ef3b7c184c4c269f953f226f7158347d007622.tar.xz
linux-f4ef3b7c184c4c269f953f226f7158347d007622.zip
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>
Diffstat (limited to 'tools/perf/util/values.c')
-rw-r--r--tools/perf/util/values.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c
index 9ac36bf2c438..2c4af02f08cd 100644
--- a/tools/perf/util/values.c
+++ b/tools/perf/util/values.c
@@ -131,7 +131,7 @@ static int perf_read_values__enlarge_counters(struct perf_read_values *values)
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;
}