diff mbox series

[2/4] libtraceevent: prevent a memory leak in process_fields()

Message ID 20240607160542.46152-3-jmarchan@redhat.com (mailing list archive)
State Accepted
Commit 03551ebce2a745127a9b6cf3765381c05621b27a
Headers show
Series libtraceevent: fix misc issues found by static analysis | expand

Commit Message

Jerome Marchand June 7, 2024, 4:05 p.m. UTC
One of the error path after field was allocated go to the wrong label.
Go to out_free_field if the allocation of arg fails.

Fixes a RESOURCE_LEAK error (CWE-772)

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/event-parse.c b/src/event-parse.c
index b625621..9f0522c 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -2963,7 +2963,7 @@  process_fields(struct tep_event *event, struct tep_print_flag_sym **list, char *
 		free_arg(arg);
 		arg = alloc_arg();
 		if (!arg)
-			goto out_free;
+			goto out_free_field;
 
 		free_token(token);
 		type = process_arg(event, arg, &token);