]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modmanager_dynamic.cpp
Fall back to copying bind IP if getsockname() fails, as it apparently can on Windows
[user/henk/code/inspircd.git] / src / modmanager_dynamic.cpp
index 9005622603f8d45df04ce87677814f5efe25021c..1fcf3aa566b2f246288a45e5a768a57e8467ccd6 100644 (file)
@@ -89,11 +89,12 @@ bool ModuleManager::Load(const char* filename)
                        newmod->ModuleSourceFile = filename_str;
                        newmod->ModuleDLLManager = newhandle;
                        Version v = newmod->GetVersion();
+                       Modules[filename_str] = newmod;
+
+                       newmod->init();
 
                        ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)%s",
                                filename, newhandle->GetVersion().c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
-
-                       Modules[filename_str] = newmod;
                }
                else
                {
@@ -106,6 +107,8 @@ bool ModuleManager::Load(const char* filename)
        catch (CoreException& modexcept)
        {
                // failure in module constructor
+               if (newmod)
+                       DoSafeUnload(newmod);
                delete newmod;
                delete newhandle;
                LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason();