aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_cloaking.cpp
diff options
context:
space:
mode:
authorGravatar brain2007-11-10 20:03:43 +0000
committerGravatar brain2007-11-10 20:03:43 +0000
commited64df98d5e2f5009fe6bda0efefbc63c2805baf (patch)
treec1e5feb45f8ebd3bf3c37e2257b721ffed693d11 /src/modules/m_cloaking.cpp
parentTidy up some minor memory leaks that can result in mode handlers or some othe... (diff)
Fix crashbugs found by owine
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@8558 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cloaking.cpp')
-rw-r--r--src/modules/m_cloaking.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index dc9b68fb9..08ecdb5dc 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -68,6 +68,7 @@ class CloakUser : public ModeHandler
public:
CloakUser(InspIRCd* Instance, Module* Source, Module* Hash) : ModeHandler(Instance, 'x', 0, 0, false, MODETYPE_USER, false), Sender(Source), HashProvider(Hash)
{
+ printf("ServerInstance: %08lx\n", ServerInstance);
}
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
@@ -314,16 +315,24 @@ class ModuleCloaking : public Module
ModuleCloaking(InspIRCd* Me)
: Module(Me)
{
- OnRehash(NULL,"");
+ /* Create new mode handler object */
+ cu = new CloakUser(ServerInstance, this, HashModule);
+
+ try
+ {
+ OnRehash(NULL,"");
+ }
+ catch (CoreException &e)
+ {
+ delete cu;
+ throw e;
+ }
/* Attempt to locate the md5 service provider, bail if we can't find it */
HashModule = ServerInstance->FindModule("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);
-
if (!ServerInstance->AddMode(cu, 'x'))
throw ModuleException("Could not add new modes!");