Blame libtraceevent-Prevent-a-memory-leak-in-process_field.patch

Jerome Marchand 7cf8e2
From 03551ebce2a745127a9b6cf3765381c05621b27a Mon Sep 17 00:00:00 2001
Jerome Marchand 7cf8e2
From: Jerome Marchand <jmarchan@redhat.com>
Jerome Marchand 7cf8e2
Date: Fri, 7 Jun 2024 18:05:40 +0200
Jerome Marchand 7cf8e2
Subject: [PATCH 4/7] libtraceevent: Prevent a memory leak in process_fields()
Jerome Marchand 7cf8e2
Jerome Marchand 7cf8e2
One of the error paths after the field was allocated goes to the wrong
Jerome Marchand 7cf8e2
label.  Go to out_free_field if the allocation of arg fails.
Jerome Marchand 7cf8e2
Jerome Marchand 7cf8e2
Fixes a RESOURCE_LEAK error (CWE-772)
Jerome Marchand 7cf8e2
Jerome Marchand 7cf8e2
Link: https://lore.kernel.org/linux-trace-devel/20240607160542.46152-3-jmarchan@redhat.com
Jerome Marchand 7cf8e2
Jerome Marchand 7cf8e2
Fixes: b17b75e511722 ("tools lib traceevent: Handle alloc_arg failure")
Jerome Marchand 7cf8e2
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Jerome Marchand 7cf8e2
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Jerome Marchand 7cf8e2
---
Jerome Marchand 7cf8e2
 src/event-parse.c | 2 +-
Jerome Marchand 7cf8e2
 1 file changed, 1 insertion(+), 1 deletion(-)
Jerome Marchand 7cf8e2
Jerome Marchand 7cf8e2
diff --git a/src/event-parse.c b/src/event-parse.c
Jerome Marchand 7cf8e2
index b625621..9f0522c 100644
Jerome Marchand 7cf8e2
--- a/src/event-parse.c
Jerome Marchand 7cf8e2
+++ b/src/event-parse.c
Jerome Marchand 7cf8e2
@@ -2963,7 +2963,7 @@ process_fields(struct tep_event *event, struct tep_print_flag_sym **list, char *
Jerome Marchand 7cf8e2
 		free_arg(arg);
Jerome Marchand 7cf8e2
 		arg = alloc_arg();
Jerome Marchand 7cf8e2
 		if (!arg)
Jerome Marchand 7cf8e2
-			goto out_free;
Jerome Marchand 7cf8e2
+			goto out_free_field;
Jerome Marchand 7cf8e2
 
Jerome Marchand 7cf8e2
 		free_token(token);
Jerome Marchand 7cf8e2
 		type = process_arg(event, arg, &token);
Jerome Marchand 7cf8e2
-- 
Jerome Marchand 7cf8e2
2.45.2
Jerome Marchand 7cf8e2