From 6ad90b92a11d818b51b3d3167086e3db4c3cd466 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Sun, 17 Mar 2019 13:40:22 -0400 Subject: [PATCH] Add missing va_end() in MsgToEventLog() Found by cppcheck Signed-off-by: Selva Nair --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 6a56d7c..da4ac02 100644 --- a/main.c +++ b/main.c @@ -871,8 +871,11 @@ MsgToEventLog(WORD type, wchar_t *format, ...) va_list args; va_start(args, format); - if (vswprintf(buf, size-1, format, args) == -1) - return; + int nchar = vswprintf(buf, size-1, format, args); + va_end(args); + + if (nchar == -1) return; + buf[size - 1] = '\0'; msg[0] = TEXT(PACKAGE_NAME);