From 7bf0c13d8d2b33cd0848b9c810f944b9d42cc5f7 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 13:17:47 +0000 Subject: [PATCH] Decompile fn_18265 (EncodeText) Batch #14665 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_18265 EncodeText: logic confirmed by peer review Peer-reviewed-by: secret, Tanke, raiken Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Network/TextEncoding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Network/TextEncoding.cpp b/Source/Network/TextEncoding.cpp index d76a1ad85..98ad459f6 100644 --- a/Source/Network/TextEncoding.cpp +++ b/Source/Network/TextEncoding.cpp @@ -137,16 +137,16 @@ std::string EncodeText(UINT codePage, const std::wstring& text) { if (length == 0) { return ""; } - char* converted = static_cast(std::malloc(length)); + char* converted = new char[length]; if (converted == nullptr) { return ""; } if (WideCharToMultiByte(codePage, 0, text.c_str(), -1, converted, length, nullptr, nullptr) == 0) { - std::free(converted); + delete[] converted; return ""; } std::string result(converted, std::strlen(converted)); - std::free(converted); + delete[] converted; return result; }