From 76eb61b408a4ead311650b370b14d2190269f756 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Thu, 11 Apr 2024 23:49:47 +0200 Subject: [PATCH] Fix use-after-free --- Source/Network/ServerList.cpp | 1 - Source/XTool/xerrhand.cpp | 2 +- Source/XTool/xerrhand.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Network/ServerList.cpp b/Source/Network/ServerList.cpp index b3a09322..96d19d2b 100644 --- a/Source/Network/ServerList.cpp +++ b/Source/Network/ServerList.cpp @@ -160,7 +160,6 @@ void ServerList::fetchRelayHostInfoList() { void ServerList::refreshHostInfoList() { if (!findingHosts || !listNeedUpdate) return; - MTG(); listNeedUpdate = false; gameInfoList.clear(); for (auto& host : lastRelayGameInfoList) { diff --git a/Source/XTool/xerrhand.cpp b/Source/XTool/xerrhand.cpp index 834a1594..7f23ac4a 100644 --- a/Source/XTool/xerrhand.cpp +++ b/Source/XTool/xerrhand.cpp @@ -487,7 +487,7 @@ void XErrorHandler::Abort(const char* message, int code, int val, const char* su //Assemble text std::ostringstream stream; - if (prefix) { + if (!prefix.empty()) { stream << prefix << std::endl; } stream << "Error ocurred! Code: " << code << " Val: " << val << std::endl; diff --git a/Source/XTool/xerrhand.h b/Source/XTool/xerrhand.h index cbc9fc6a..6fff4f17 100644 --- a/Source/XTool/xerrhand.h +++ b/Source/XTool/xerrhand.h @@ -32,7 +32,7 @@ struct XErrorHandler { unsigned state; - const char* prefix; + std::string prefix; std::string log_path;