diff mbox series

libtracefs: Initialized func_list in tracefs_filter_functions()

Message ID 20220125215305.08cf1eb3@gandalf.local.home (mailing list archive)
State Accepted
Commit adaf1ccce791f8e7ad0bcf93626c11b6c4899065
Headers show
Series libtracefs: Initialized func_list in tracefs_filter_functions() | expand

Commit Message

Steven Rostedt Jan. 26, 2022, 2:53 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The variable func_list is used to create a link list and it is expected to
be NULL. This causes a crash because of the logic checks it before it gets
initialized.

Initialize func_list to NULL.

This was found by valgrind after a crash.

Fixes: c1606fb72264a ("libtracefs: Implement tracefs_filter_functions()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c
index ae85444b67dd..489be28a3b94 100644
--- a/src/tracefs-tools.c
+++ b/src/tracefs-tools.c
@@ -1237,7 +1237,7 @@  void tracefs_trace_pipe_stop(struct tracefs_instance *instance)
 int tracefs_filter_functions(const char *filter, const char *module, char ***list)
 {
 	struct func_filter func_filter;
-	struct func_list *func_list, *f;
+	struct func_list *func_list = NULL, *f;
 	char **funcs = NULL;
 	int ret;