From d51f650d86d2e6264f69df56f699266545cc06af Mon Sep 17 00:00:00 2001 From: peavey Date: Thu, 28 Dec 2006 13:45:25 +0000 Subject: Add cleanup of objects on readconf and in destructor. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6132 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_dnsbl.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 3d6c419c9..e396c766e 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -184,6 +184,7 @@ class ModuleDNSBL : public Module virtual ~ModuleDNSBL() { + ClearEntries(); } virtual Version GetVersion() @@ -196,13 +197,26 @@ class ModuleDNSBL : public Module List[I_OnRehash] = List[I_OnUserRegister] = 1; } + + void ClearEntries() + { + std::vector::iterator i, safei; + while ((i = DNSBLConfEntries.begin()) != DNSBLConfEntries.end()) + { + DNSBLConfEntries.erase(i); + delete *i; + } + + } + + /* * Fill our conf vector with data */ virtual void ReadConf() { ConfigReader *MyConf = new ConfigReader(ServerInstance); - DNSBLConfEntries.clear(); + ClearEntries(); for (int i=0; i< MyConf->Enumerate("dnsbl"); i++) { -- cgit v1.2.3