diff mbox series

[04/23] libtracefs: Free buf in clear_func_filter()

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

Commit Message

Steven Rostedt Dec. 28, 2023, 8:35 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)