From 46737acecdf5abfdd039d4f646ff3f7ea259a826 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 6 Dec 2021 19:37:22 +1000 Subject: [PATCH] CPU: Prevent mismatched va_start/va_end in log --- src/core/cpu_core.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index ed1ed248d..8389955a7 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -67,9 +67,6 @@ void StopTrace() void WriteToExecutionLog(const char* format, ...) { - std::va_list ap; - va_start(ap, format); - if (!s_log_file_opened) { s_log_file = FileSystem::OpenCFile("cpu_log.txt", "wb"); @@ -78,13 +75,15 @@ void WriteToExecutionLog(const char* format, ...) if (s_log_file) { + std::va_list ap; + va_start(ap, format); std::vfprintf(s_log_file, format, ap); + va_end(ap); + #ifdef _DEBUG std::fflush(s_log_file); #endif } - - va_end(ap); } void Initialize()