diff options
author | Sadie Powell <sadie@witchery.services> | 2020-02-14 01:25:09 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-02-14 01:36:35 +0000 |
commit | 8d5adb667fcdf05dc87b1091359b66ae7e12d090 (patch) | |
tree | 237a41888025d253fda7cd42a94d744c076cd42b | |
parent | c0f75dd4f5a54d593d0b9afcb71e266cf6a86c29 (diff) |
Clean up ModuleDLLManager from the Module::cull() method.
This avoids a leak which happens in some rare circumstances.
-rw-r--r-- | src/coremods/core_reloadmodule.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp index b330797d5..98bf2ab40 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -720,11 +720,9 @@ class ReloadAction : public ActionBase ReloadModule::DataKeeper datakeeper; datakeeper.Save(mod); - DLLManager* dll = mod->ModuleDLLManager; std::string name = mod->ModuleSourceFile; ServerInstance->Modules->DoSafeUnload(mod); ServerInstance->GlobalCulls.Apply(); - delete dll; bool result = ServerInstance->Modules->Load(name); if (result) diff --git a/src/modules.cpp b/src/modules.cpp index 2bb594a57..73bd2a5e2 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -64,6 +64,8 @@ Module::Module() CullResult Module::cull() { + if (ModuleDLLManager) + ServerInstance->GlobalCulls.AddItem(ModuleDLLManager); return classbase::cull(); } @@ -450,11 +452,8 @@ namespace UnloadAction(Module* m) : mod(m) {} void Call() CXX11_OVERRIDE { - DLLManager* dll = mod->ModuleDLLManager; ServerInstance->Modules->DoSafeUnload(mod); ServerInstance->GlobalCulls.Apply(); - // In pure static mode this is always NULL - delete dll; ServerInstance->GlobalCulls.AddItem(this); } }; |