[PATCH] libtracefs: Initialized func_list in tracefs_filter_functions()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
 src/tracefs-tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.33.0




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux