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
@@ -94,7 +94,7 @@ Rule::Rule(std::string marker)
|
||||
m_secmarker(true),
|
||||
m_marker(marker),
|
||||
m_maturity(0),
|
||||
m_referenceCount(0),
|
||||
m_referenceCount(1),
|
||||
m_fileName(""),
|
||||
m_lineNumber(0) { }
|
||||
|
||||
@@ -113,7 +113,7 @@ Rule::Rule(Operator *_op,
|
||||
m_secmarker(false),
|
||||
m_marker(""),
|
||||
m_maturity(0),
|
||||
m_referenceCount(0),
|
||||
m_referenceCount(1),
|
||||
m_fileName(fileName),
|
||||
m_lineNumber(lineNumber) {
|
||||
if (actions != NULL) {
|
||||
|
20
src/rules.cc
20
src/rules.cc
@@ -78,28 +78,8 @@ void Rules::decrementReferenceCount(void) {
|
||||
|
||||
|
||||
Rules::~Rules() {
|
||||
int i = 0;
|
||||
|
||||
free(unicode_map_table);
|
||||
unicode_map_table = NULL;
|
||||
|
||||
/** Cleanup the rules */
|
||||
for (int i = 0; i < modsecurity::Phases::NUMBER_OF_PHASES; i++) {
|
||||
std::vector<Rule *> rules = m_rules[i];
|
||||
while (rules.empty() == false) {
|
||||
Rule *rule = rules.back();
|
||||
rule->refCountDecreaseAndCheck();
|
||||
rules.pop_back();
|
||||
}
|
||||
}
|
||||
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();
|
||||
a->refCountDecreaseAndCheck();
|
||||
tmp->pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user