diff mbox series

[1/4] libtracefs: Initialized func_list in tracefs_filter_functions()

Message ID 20220131163642.2754485-2-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit adaf1ccce791f8e7ad0bcf93626c11b6c4899065
Headers show
Series libtracefs: synthetic event fixes | expand

Commit Message

Steven Rostedt Jan. 31, 2022, 4:36 p.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;