Skip to contentSkip to conversation

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

PATCH New Steven Rostedt 1 participant 1 message Apr 10, 2025

lore
Share & tools
lore
#0 lore raw

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

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

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")
---
 tracecmd/trace-sqlhist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tracecmd/trace-sqlhist.c +1 -1
index 9f2b94e6..ee7eed82 100644
@@ -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)
Signature · 1 line
2.47.2