[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231120112356.8652-1-zhaimingbing@cmss.chinamobile.com>
Date: Mon, 20 Nov 2023 19:23:56 +0800
From: zhaimingbing <zhaimingbing@...s.chinamobile.com>
To: Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
Li Dong <lidong@...o.com>
Cc: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
zhaimingbing <zhaimingbing@...s.chinamobile.com>
Subject: [PATCH] perf script perl: Fail check on dynamic allocation
Return ENOMEM when dynamic allocation failed.
Signed-off-by: zhaimingbing <zhaimingbing@...s.chinamobile.com>
---
tools/perf/util/scripting-engines/trace-event-perl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 603091317..b072ac5d3 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++)
--
2.33.0
Powered by blists - more mailing lists