aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorChris Samuel <chris@csamuel.org>2010-11-13 13:35:06 +1100
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-06 12:52:35 -0200
commitce47dc56a2241dc035160a85bc5e34283cdd622c (patch)
treed9404df9d3ca0ddacdd8faae791ece27206dece4 /tools/perf/util/header.c
parentperf script: Fix compiler warning in builtin_script.c:is_top_script() (diff)
downloadlinux-dev-ce47dc56a2241dc035160a85bc5e34283cdd622c.tar.xz
linux-dev-ce47dc56a2241dc035160a85bc5e34283cdd622c.zip
perf tools: Catch a few uncheck calloc/malloc's
There were a few stray calloc()'s and malloc()'s which were not having their return values checked for success. As the calling code either already coped with failure or didn't actually care we just return -ENOMEM at that point. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Chris Samuel <chris@csamuel.org> LKML-Reference: <4CDDF95A.1050400@csamuel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 073f0e1c7123..76e949a59ea4 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1005,6 +1005,9 @@ int event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id,
ev = malloc(size);
+ if (ev == NULL)
+ return -ENOMEM;
+
ev->attr.attr = *attr;
memcpy(ev->attr.id, id, ids * sizeof(u64));