diff mbox series

[26/38] trace-cmd record: don't print a NULL string in get_temp_file()

Message ID 20240605134054.2626953-27-jmarchan@redhat.com (mailing list archive)
State Accepted
Commit 531328aa20289f904e630c2b25d5e4e889c68c6a
Headers show
Series trace-cmd: fix misc issues found by static analysis | expand

Commit Message

Jerome Marchand June 5, 2024, 1:40 p.m. UTC
In get_temp_file() if we fails to allocate a temp file for a top
instance, a NULL pointer is passed as the argument for a %s format in
the error message.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 tracecmd/trace-record.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 2223d5bb..b4cbd438 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -559,7 +559,7 @@  static char *get_temp_file(struct buffer_instance *instance, int cpu)
 		size = snprintf(file, 0, "%s.cpu%d", output_file, cpu);
 		file = malloc(size + 1);
 		if (!file)
-			die("Failed to allocate temp file for %s", name);
+			die("Failed to allocate temp file");
 		sprintf(file, "%s.cpu%d", output_file, cpu);
 	}