]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Same here, fix some minor memory leaks noticed by w00t
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 9 Nov 2007 17:18:19 +0000 (17:18 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 9 Nov 2007 17:18:19 +0000 (17:18 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8551 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_auditorium.cpp
src/modules/m_banredirect.cpp
src/modules/m_blockamsg.cpp
src/modules/m_blockcaps.cpp
src/modules/m_censor.cpp
src/modules/m_cgiirc.cpp
src/modules/m_chanprotect.cpp
src/modules/m_oper_hash.cpp

index 6a8a57b2bce736b50c656c74c101eabd3e9c218e..d75175feddc4df4846a9506fab71f74bd5ab5a48 100644 (file)
@@ -55,7 +55,10 @@ class ModuleAuditorium : public Module
        {
                aum = new AuditoriumMode(ServerInstance);
                if (!ServerInstance->AddMode(aum))
+               {
+                       delete aum;
                        throw ModuleException("Could not add new modes!");
+               }
 
                OnRehash(NULL, "");
 
index 4a46a7264535a485b5095db9a45866f4bffb9d1d..363da21d753ed9740f2d76f36f4f93d744b5bdfb 100644 (file)
@@ -194,7 +194,10 @@ class ModuleBanRedirect : public Module
                nofollow = false;
                
                if(!ServerInstance->AddModeWatcher(re))
+               {
+                       delete re;
                        throw ModuleException("Could not add mode watcher");
+               }
 
                OnRehash(NULL, "");
 
index 4e02a84c00febe519ce2a0a51b3bef882d16ebf4..4741eebef0b27225e1dab096fa4aed1593af0fd3 100644 (file)
@@ -44,10 +44,8 @@ class ModuleBlockAmsg : public Module
        BlockAction action;
        
  public:
-       ModuleBlockAmsg(InspIRCd* Me)
-       : Module(Me)
+       ModuleBlockAmsg(InspIRCd* Me) : Module(Me)
        {
-               
                this->OnRehash(NULL,"");
                Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_OnCleanup };
                ServerInstance->Modules->Attach(eventlist, this, 3);
index c041feb31af565b0871467573b654f919ceeeb47..44ad7e8916bca76d8c87b365ec56b0fad17b7871 100644 (file)
@@ -59,7 +59,10 @@ public:
                OnRehash(NULL,"");
                bc = new BlockCaps(ServerInstance);
                if (!ServerInstance->AddMode(bc))
+               {
+                       delete bc;
                        throw ModuleException("Could not add new modes!");
+               }
                Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 3);
        }
index e29b10194a4325b52cf3302dc1492a8b71f728ca..426d90cc9c6b0b7b4371719ae6a4c8056b364688 100644 (file)
@@ -98,7 +98,11 @@ class ModuleCensor : public Module
                cu = new CensorUser(ServerInstance);
                cc = new CensorChannel(ServerInstance);
                if (!ServerInstance->AddMode(cu) || !ServerInstance->AddMode(cc))
+               {
+                       delete cu;
+                       delete cc;
                        throw ModuleException("Could not add new modes!");
+               }
                Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice };
                ServerInstance->Modules->Attach(eventlist, this, 3);
        }
index eebaf7d1d71bdf71c19ced9d2c41c167da524c50..c0739cb9c1adbd805b58173b58af0b4ae20f9587 100644 (file)
@@ -131,8 +131,9 @@ public:
        {
                
                OnRehash(NULL,"");
-               mycommand=new CommandWebirc(Me, Hosts, NotifyOpers);
+               mycommand = new CommandWebirc(Me, Hosts, NotifyOpers);
                ServerInstance->AddCommand(mycommand);
+
                Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCleanup, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUserQuit, I_OnUserConnect };
                ServerInstance->Modules->Attach(eventlist, this, 7);
        }
index 54691f05d809857ad66b5a0b986741d419deefb2..84aada158d943d0a7f044ebf070d2e980254777a 100644 (file)
@@ -309,7 +309,11 @@ class ModuleChanProtect : public Module
                cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf,DeprivOthers);
 
                if (!ServerInstance->AddMode(cp) || !ServerInstance->AddMode(cf))
+               {
+                       delete cp;
+                       delete cf;
                        throw ModuleException("Could not add new modes!");
+               }
 
                Implementation eventlist[] = { I_OnUserKick, I_OnUserPart, I_OnRehash, I_OnUserPreJoin, I_OnPostJoin, I_OnAccessCheck, I_OnSyncChannel };
                ServerInstance->Modules->Attach(eventlist, this, 7);
index 75a5b695e085d37e802a24e673cf904cd6d11cac..83166bc59c3f4daecfc147869426a733b881c168 100644 (file)
@@ -81,8 +81,6 @@ class ModuleOperHash : public Module
                Conf = NULL;
                OnRehash(NULL,"");
 
-               ServerInstance->Modules->UseInterface("HashRequest");
-
                /* Find all modules which implement the interface 'HashRequest' */
                modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest");
 
@@ -106,6 +104,8 @@ class ModuleOperHash : public Module
                        throw ModuleException("I can't find any modules loaded which implement the HashRequest interface! You probably forgot to load a hashing module such as m_md5.so or m_sha256.so.");
                }
 
+               ServerInstance->Modules->UseInterface("HashRequest");
+
                mycommand = new CommandMkpasswd(ServerInstance, this, hashers, names);
                ServerInstance->AddCommand(mycommand);
                Implementation eventlist[] = { I_OnRehash, I_OnOperCompare };