diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-11-09 17:05:42 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-11-09 17:05:42 +0000 |
commit | ae821d38d9a0026d18c64b4fe3be4594e28e4980 (patch) | |
tree | a8abbc3f337d22313e82d6fcb4a76dae262ff028 | |
parent | 12923aae21367d948c74e4bdceaf98b61d9f4992 (diff) |
Theres actually more to this. Before we throw, delete cu (the destructor WONT be called if we throw from a constructor, we must do this tidyup ourselves)
And move some other throws below OnRehash call
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8548 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_cloaking.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index c0edf21a9..f0f754551 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -321,19 +321,25 @@ class ModuleCloaking : public Module { ServerInstance->Modules->UseInterface("HashRequest"); - /* Attempt to locate the md5 service provider, bail if we can't find it */ - HashModule = ServerInstance->Modules->Find("m_md5.so"); - if (!HashModule) - throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_cloaking.so."); - /* Create new mode handler object */ cu = new CloakUser(ServerInstance, this, HashModule); OnRehash(NULL,""); + /* Attempt to locate the md5 service provider, bail if we can't find it */ + HashModule = ServerInstance->Modules->Find("m_md5.so"); + if (!HashModule) + { + delete cu; + throw ModuleException("Can't find m_md5.so. Please load m_md5.so before m_cloaking.so."); + } + /* Register it with the core */ if (!ServerInstance->AddMode(cu)) + { + delete cu; throw ModuleException("Could not add new modes!"); + } Implementation eventlist[] = { I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 1); |