diff options
-rw-r--r-- | src/modules/extra/m_filter_pcre.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 10 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index dde7575ab..a7829871f 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -81,6 +81,7 @@ class ModuleFilterPCRE : public FilterBase { if (i->freeform == freeform) { + pcre_free((*i).regexp); filters.erase(i); return true; } @@ -125,13 +126,10 @@ class ModuleFilterPCRE : public FilterBase { ConfigReader MyConf(ServerInstance); - for (std::vector<PCREFilter>::iterator i = filters.begin(); i != filters.end(); i++) - pcre_free((*i).regexp); - - filters.clear(); - for (int index = 0; index < MyConf.Enumerate("keyword"); index++) { + this->DeleteFilter(MyConf.ReadValue("keyword", "pattern", index)); + std::string pattern = MyConf.ReadValue("keyword", "pattern", index); std::string reason = MyConf.ReadValue("keyword", "reason", index); std::string action = MyConf.ReadValue("keyword", "action", index); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 88665e8b3..b0ace124e 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -66,6 +66,7 @@ class ModuleFilter : public FilterBase { if (filters.find(freeform) != filters.end()) { + delete (filters.find(freeform))->second; filters.erase(filters.find(freeform)); return true; } @@ -99,15 +100,12 @@ class ModuleFilter : public FilterBase virtual void OnRehash(const std::string ¶meter) { - // this automatically re-reads the configuration file into the class ConfigReader* MyConf = new ConfigReader(ServerInstance); - for (filter_t::iterator n = filters.begin(); n != filters.end(); n++) - { - DELETE(n->second); - } - filters.clear(); + for (int index = 0; index < MyConf->Enumerate("keyword"); index++) { + this->DeleteFilter(MyConf->ReadValue("keyword","pattern",index)); + std::string pattern = MyConf->ReadValue("keyword","pattern",index); std::string reason = MyConf->ReadValue("keyword","reason",index); std::string do_action = MyConf->ReadValue("keyword","action",index); |