From c708d7a3c0defba07171a70c68636d0b14abf590 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 9 Nov 2007 17:18:19 +0000 Subject: Same here, fix some minor memory leaks noticed by w00t git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8551 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_auditorium.cpp | 3 +++ src/modules/m_banredirect.cpp | 3 +++ src/modules/m_blockamsg.cpp | 4 +--- src/modules/m_blockcaps.cpp | 3 +++ src/modules/m_censor.cpp | 4 ++++ src/modules/m_cgiirc.cpp | 3 ++- src/modules/m_chanprotect.cpp | 4 ++++ src/modules/m_oper_hash.cpp | 4 ++-- 8 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 6a8a57b2b..d75175fed 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -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, ""); diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 4a46a7264..363da21d7 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -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, ""); diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 4e02a84c0..4741eebef 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -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); diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index c041feb31..44ad7e891 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -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); } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index e29b10194..426d90cc9 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -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); } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index eebaf7d1d..c0739cb9c 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -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); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 54691f05d..84aada158 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -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); diff --git a/src/modules/m_oper_hash.cpp b/src/modules/m_oper_hash.cpp index 75a5b695e..83166bc59 100644 --- a/src/modules/m_oper_hash.cpp +++ b/src/modules/m_oper_hash.cpp @@ -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 }; -- cgit v1.2.3