mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Moving the rules deletion to the RuleProperties class
The deletion was happning on the Rule class due to historical reasons. The consequence of that was a parser memory leak.
This commit is contained in:
committed by
Felipe Zimmerle
parent
068a3eb517
commit
a8e5cce744
@@ -102,6 +102,29 @@ class RulesProperties {
|
||||
|
||||
|
||||
~RulesProperties() {
|
||||
int i = 0;
|
||||
/** Cleanup the rules */
|
||||
for (i = 0; i < modsecurity::Phases::NUMBER_OF_PHASES; i++) {
|
||||
std::vector<Rule *> rules = m_rules[i];
|
||||
while (rules.empty() == false) {
|
||||
Rule *rule = rules.back();
|
||||
rules.pop_back();
|
||||
if (rule->refCountDecreaseAndCheck()) {
|
||||
rule = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < modsecurity::Phases::NUMBER_OF_PHASES; i++) {
|
||||
std::vector<actions::Action *> *tmp = &m_defaultActions[i];
|
||||
while (tmp->empty() == false) {
|
||||
actions::Action *a = tmp->back();
|
||||
tmp->pop_back();
|
||||
if (a->refCountDecreaseAndCheck()) {
|
||||
a = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete m_debugLog;
|
||||
delete m_auditLog;
|
||||
}
|
||||
|
Reference in New Issue
Block a user