diff mbox series

trace-cmd sqlhist: Initialize err value to tracefs_sql()

Message ID 20250410093810.14642ddc@gandalf.local.home (mailing list archive)
State Accepted
Commit d6241881679fbc96ea1045dd2c5ca04631a76150
Headers show
Series trace-cmd sqlhist: Initialize err value to tracefs_sql() | expand

Commit Message

Steven Rostedt April 10, 2025, 1:38 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

If tracefs_sql() fails, it doesn't always initialize the passed in "err"
pointer. That should be set to NULL before passing it in otherwise it can't
be known if the function set it on error.

Fixes: 1d5ac88ee ("trace-cmd sqlhist: Add 'sqlhist' command")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-sqlhist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-sqlhist.c b/tracecmd/trace-sqlhist.c
index 9f2b94e6..ee7eed82 100644
--- a/tracecmd/trace-sqlhist.c
+++ b/tracecmd/trace-sqlhist.c
@@ -28,7 +28,7 @@  static int do_sql(const char *instance_name,
 	struct tep_handle *tep;
 	struct trace_seq seq;
 	enum tracefs_synth_handler handler;
-	char *err;
+	char *err = NULL;
 	int ret;
 
 	if ((action & ACTIONS) && !var)