This should be safe. Someone test module loading and unloading during use and make sure stuff doesnt fall over.

Also test some misconfigured modules, e.g. try and load m_services with m_services_account.


git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7388 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2007-06-18 22:49:47 +00:00
parent 06c4fa4299
commit 61838d28cf

View File

@ -953,6 +953,7 @@ bool InspIRCd::LoadModule(const char* filename)
return false;
}
}
Module* m = NULL;
try
{
ircd_module* a = new ircd_module(this, modfile);
@ -966,7 +967,7 @@ bool InspIRCd::LoadModule(const char* filename)
}
if ((long)factory[this->ModCount+1]->factory != -1)
{
Module* m = factory[this->ModCount+1]->factory->CreateModule(this);
m = factory[this->ModCount+1]->factory->CreateModule(this);
Version v = m->GetVersion();
@ -1001,6 +1002,7 @@ bool InspIRCd::LoadModule(const char* filename)
{
this->Log(DEFAULT,"Unable to load %s",modfile);
snprintf(MODERR,MAXBUF,"Factory function failed: Probably missing init_module() entrypoint.");
delete a;
return false;
}
}
@ -1008,6 +1010,9 @@ bool InspIRCd::LoadModule(const char* filename)
{
this->Log(DEFAULT,"Unable to load %s: %s",modfile,modexcept.GetReason());
snprintf(MODERR,MAXBUF,"Factory function of %s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
if (m)
delete m;
delete a;
return false;
}
}