summaryrefslogtreecommitdiff
path: root/src/modmanager_dynamic.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-12-02 19:59:42 +0100
committerattilamolnar <attilamolnar@hush.com>2012-12-02 20:34:33 +0100
commit8095fb6079c3416cf2aa0147154f440466a6e11d (patch)
treee05d66b3e61f8869baddbf518482758fa56d5766 /src/modmanager_dynamic.cpp
parenteea9343393614f81169eaf9ac1fcab1db949d018 (diff)
Fix DLLManager leak when an exception is thrown in init()
This also caused the dlopen()'d library to stay open forever
Diffstat (limited to 'src/modmanager_dynamic.cpp')
-rw-r--r--src/modmanager_dynamic.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp
index 27da56c69..5406cfd33 100644
--- a/src/modmanager_dynamic.cpp
+++ b/src/modmanager_dynamic.cpp
@@ -94,7 +94,10 @@ bool ModuleManager::Load(const std::string& filename, bool defer)
{
// failure in module constructor
if (newmod)
+ {
DoSafeUnload(newmod);
+ ServerInstance->GlobalCulls.AddItem(newhandle);
+ }
else
delete newhandle;
LastModuleError = "Unable to load " + filename + ": " + modexcept.GetReason();
@@ -228,7 +231,7 @@ void ModuleManager::LoadAll()
for(std::map<std::string, Module*>::iterator i = Modules.begin(); i != Modules.end(); i++)
{
Module* mod = i->second;
- try
+ try
{
ServerInstance->Logs->Log("MODULE", DEBUG, "Initializing %s", i->first.c_str());
mod->init();