From ae821d38d9a0026d18c64b4fe3be4594e28e4980 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 9 Nov 2007 17:05:42 +0000 Subject: 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 --- src/modules/m_cloaking.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/modules') 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); -- cgit v1.2.3