From 00702df792076ae3e9b5af45675e90b7b9590a04 Mon Sep 17 00:00:00 2001 From: Mr0maks Date: Sun, 10 May 2020 01:39:40 +0500 Subject: [PATCH] Fix errors with va_list reported by cppcheck --- src/core/logging.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/logging.cpp b/src/core/logging.cpp index 02a5a363..945e09a7 100644 --- a/src/core/logging.cpp +++ b/src/core/logging.cpp @@ -66,9 +66,10 @@ void logging::Info(const char *fmt, ...) // Allocate buffer char result[512]; // Fill buffer - if (vsnprintf(result, 512, fmt, list) < 0) - return; + int size = vsnprintf(result, 512, fmt, list); va_end(list); + if(size < 0) + return; Log(result, false); #endif @@ -85,9 +86,10 @@ void logging::File(const char *fmt, ...) // Allocate buffer char result[512]; // Fill buffer - if (vsnprintf(result, 512, fmt, list) < 0) - return; + int size = vsnprintf(result, 512, fmt, list); va_end(list); + if(size < 0) + return; Log(result, true); #endif