From ce47dc56a2241dc035160a85bc5e34283cdd622c Mon Sep 17 00:00:00 2001 From: Chris Samuel Date: Sat, 13 Nov 2010 13:35:06 +1100 Subject: 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 Cc: Paul Mackerras Cc: Peter Zijlstra Signed-off-by: Chris Samuel LKML-Reference: <4CDDF95A.1050400@csamuel.org> Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/header.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/perf/util/header.c') diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 073f0e1c712..76e949a59ea 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)); -- cgit v1.2.3