From a9df133c56643fd3bf276df1a66e13de2ff41811 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 17:20:16 +0000 Subject: [PATCH] Decompile fn_01131 (CLuaInstance::LoadFile) Batch #14592 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_01131 CLuaInstance::LoadFile: logic confirmed by peer review Peer-reviewed-by: secret, Tanke, codeplay Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Script/LuaInstance.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Script/LuaInstance.cpp b/Source/Script/LuaInstance.cpp index 9f7a0cacb..0ebb127a2 100644 --- a/Source/Script/LuaInstance.cpp +++ b/Source/Script/LuaInstance.cpp @@ -76,20 +76,20 @@ bool CLuaInstance::LoadFile(const std::string& path) { return false; } - char* buffer = static_cast(std::malloc(file.GetSize() + 1)); + char* buffer = new char[file.GetSize() + 1]; SecureZeroMemory(buffer, file.GetSize() + 1); file.Read(buffer, file.GetSize()); file.Close(); if (luaL_loadbuffer(this->m_state, buffer, file.GetSize(), "buf") == 0 && lua_pcall(this->m_state, 0, 0, 0) == 0) { - std::free(buffer); + delete[] buffer; return true; } const char* error = lua_tostring(this->m_state, -1); MessageBoxA(nullptr, error, path.c_str(), MB_OK); lua_pop(this->m_state, 1); - std::free(buffer); + delete[] buffer; return false; }