Skip to contentSkip to conversation

trace-cmd record: Check allocation of creating path variable

PATCH New Steven Rostedt 1 participant 1 message Oct 21

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd record: Check allocation of creating path variable

From: Steven Rostedt <[email protected]>

The reset->path = strdup(file) should check if the allocation fails.

---
 tracecmd/trace-record.c | 2 ++
 1 file changed, 2 insertions(+)
tracecmd/trace-record.c +2 -0
index 1ee3effca114..3a6e4759aed2 100644
@@ -262,6 +262,8 @@ static void add_reset_trigger(const char *file)
 	if (!reset)
 		die("Failed to allocate reset");
 	reset->path = strdup(file);
+	if (!reset->path)
+		die("Failed to allocate path");
 
 	reset->next = reset_triggers;
 	reset_triggers = reset;
Signature · 1 line
2.53.0