From 45496c33f1b6ed35701625bfb0de3598c7ebe7b4 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 19 Oct 2019 00:37:48 +0300 Subject: [PATCH] test: fix printf("%s", NULL) in error path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ../test/common.c: In function ‘test_get_path’: ../test/common.c:171:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 171 | fprintf(stderr, "Failed to allocate path (%d chars) for %s\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 172 | (int) path_len, path); | ~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ran Benita --- test/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common.c b/test/common.c index c909707..c371272 100644 --- a/test/common.c +++ b/test/common.c @@ -169,7 +169,7 @@ test_get_path(const char *path_rel) path = malloc(path_len); if (!path) { fprintf(stderr, "Failed to allocate path (%d chars) for %s\n", - (int) path_len, path); + (int) path_len, path_rel); return NULL; } snprintf(path, path_len, -- 2.7.4