Skip to contentSkip to conversation

libtracefs: Initialized func_list in tracefs_filter_functions()

PATCH New Steven Rostedt 1 participant 1 message Jan 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Initialized func_list in tracefs_filter_functions()

From: "Steven Rostedt (Google)" <[email protected]>

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()")
---
 src/tracefs-tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/tracefs-tools.c +1 -1
index ae85444b67dd..489be28a3b94 100644
@@ -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;
 
Signature · 1 line
2.33.0