public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf script perl: Fail check on dynamic allocation
@ 2023-11-20 11:23 zhaimingbing
  2023-11-21  0:30 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: zhaimingbing @ 2023-11-20 11:23 UTC (permalink / raw)
  To: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, Sean Christopherson,
	Li Dong
  Cc: linux-perf-users, linux-kernel, zhaimingbing

Return ENOMEM when dynamic allocation failed.

Signed-off-by: zhaimingbing <zhaimingbing@cmss.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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-21 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 11:23 [PATCH] perf script perl: Fail check on dynamic allocation zhaimingbing
2023-11-21  0:30 ` Ian Rogers
2023-11-21 17:23   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox