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/builtin-timechart.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/perf/builtin-timechart.c') diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 1f158dc03349..d2fc46103f83 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -989,6 +989,9 @@ static int __cmd_record(int argc, const char **argv) rec_argc = ARRAY_SIZE(record_args) + argc - 1; rec_argv = calloc(rec_argc + 1, sizeof(char *)); + if (rec_argv == NULL) + return -ENOMEM; + for (i = 0; i < ARRAY_SIZE(record_args); i++) rec_argv[i] = strdup(record_args[i]); -- cgit v1.2.3-59-g8ed1b