summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhaimingbing <zhaimingbing@cmss.chinamobile.com>2023-11-20 12:23:56 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-11-27 14:21:27 +0100
commitcd38d6b5fa2dfc3beb7311f0b373e3141620c76b (patch)
tree5d89a3e3323fc52ff8a93d9a18343b0e0e1f113b
parentperf script python: Fail check on dynamic allocation (diff)
downloadlinux-cd38d6b5fa2dfc3beb7311f0b373e3141620c76b.tar.xz
linux-cd38d6b5fa2dfc3beb7311f0b373e3141620c76b.zip
perf script perl: Fail check on dynamic allocation
Return ENOMEM when dynamic allocation failed. Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Li Dong <lidong@vivo.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20231120112356.8652-1-zhaimingbing@cmss.chinamobile.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 603091317bed..b072ac5d3bc2 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -490,6 +490,9 @@ static int perl_start_script(const char *script, int argc, const char **argv,
scripting_context->session = session;
command_line = malloc((argc + 2) * sizeof(const char *));
+ if (!command_line)
+ return -ENOMEM;
+
command_line[0] = "";
command_line[1] = script;
for (i = 2; i < argc + 2; i++)