diff mbox series

[v2,04/22] libtracefs: Free buf in clear_func_filter()

Message ID 20231228215433.54854-5-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit df563eb1f0bfacd38ce682ba63d60a195e74a75f
Headers show
Series libtracefs: Several updates | expand

Commit Message

Steven Rostedt Dec. 28, 2023, 9:51 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The buf variable was allocated via tracefs_instance_file_read() but must be
freed with free().

Fixes: 789e82d7 ("libtracefs: New API to reset ftrace instance")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-instance.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
index c385a078ecec..2efcc75dfd98 100644
--- a/src/tracefs-instance.c
+++ b/src/tracefs-instance.c
@@ -1371,6 +1371,7 @@  static void clear_func_filter(struct tracefs_instance *instance, const char *fil
 		filter[len+1] = '\0';
 		tracefs_instance_file_append(instance, file, filter);
 	}
+	free(buf);
 }
 
 static void clear_func_filters(struct tracefs_instance *instance)