From 93a92bb73b33b9970a6483f153170442eff95941 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 23 Sep 2015 14:54:41 -0400 Subject: Clear regex xlines on unload, which happens on shutdown, even though they are perm modules --- modules/extra/m_regex_pcre.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'modules/extra/m_regex_pcre.cpp') diff --git a/modules/extra/m_regex_pcre.cpp b/modules/extra/m_regex_pcre.cpp index 7cbde87db..180fb9949 100644 --- a/modules/extra/m_regex_pcre.cpp +++ b/modules/extra/m_regex_pcre.cpp @@ -50,6 +50,26 @@ class ModuleRegexPCRE : public Module { this->SetPermanent(true); } + + ~ModuleRegexPCRE() + { + for (std::list::iterator it = XLineManager::XLineManagers.begin(); it != XLineManager::XLineManagers.end(); ++it) + { + XLineManager *xlm = *it; + const std::vector &xlines = xlm->GetList(); + + for (unsigned int i = 0; i < xlines.size(); ++i) + { + XLine *x = xlines[i]; + + if (x->regex && dynamic_cast(x->regex)) + { + delete x->regex; + x->regex = NULL; + } + } + } + } }; MODULE_INIT(ModuleRegexPCRE) -- cgit