From 01a7119ac1fe1b6332181bbf70dd07e08a90efea Mon Sep 17 00:00:00 2001 From: Causeless Date: Thu, 28 Dec 2023 21:16:35 +0000 Subject: [PATCH] Fixed memory leak --- Managers/LuaMan.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Managers/LuaMan.cpp b/Managers/LuaMan.cpp index d9c4ce4e7..031baa083 100644 --- a/Managers/LuaMan.cpp +++ b/Managers/LuaMan.cpp @@ -723,6 +723,9 @@ namespace RTE { } auto& newScript = m_ScriptCache[funcObjectName.c_str()]; + for (auto& pair : newScript.functionNamesAndObjects) { + delete pair.second; + } newScript.functionNamesAndObjects.clear(); for (const std::string& functionName : functionNamesToLookFor) { luabind::object functionObject = funcHoldingObject[functionName];