[PATCH] uefi: uefidump: missing va_end on str == NULL return path

Colin King colin.king at canonical.com
Mon May 6 23:56:12 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Coverity CID #997322, Missing varargs init or cleanup (VARARGS)

Coverity detected a missing va_end on the str == NULL error
return path.  Fix this by using va_end() immediately after we
finish using args.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/uefi/uefidump/uefidump.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
index 771f904..fa914ba 100644
--- a/src/uefi/uefidump/uefidump.c
+++ b/src/uefi/uefidump/uefidump.c
@@ -60,8 +60,8 @@ static char *uefidump_vprintf(char *str, const char *fmt, ...)
 	char buffer[4096];
 
 	va_start(args, fmt);
-
 	vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
 
 	if (str == NULL)
 		str = strdup(buffer);
@@ -72,7 +72,6 @@ static char *uefidump_vprintf(char *str, const char *fmt, ...)
 		strcat(str, buffer);
 	}
 
-	va_end(args);
 	return str;
 }
 
-- 
1.8.1.2




More information about the fwts-devel mailing list