Skip to content

Commit 18d757f

Browse files
committed
Fix two rule-reload memory leak issues
1 parent 17f3bb0 commit 18d757f

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v3.x.y - YYYY-MMM-DD (to be released)
22
-------------------------------------
33

4+
- Fix two rule-reload memory leak issues
5+
[Issue #2801 - @Abce, @martinhsv]
46
- Correct whitespace handling for Include directive
57
[Issue #2800 - @877509395, @martinhsv]
68

headers/modsecurity/rule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ class Rule {
8686
return *this;
8787
}
8888

89+
virtual ~Rule() {}
90+
8991
virtual bool evaluate(Transaction *transaction) = 0;
9092

9193
virtual bool evaluate(Transaction *transaction,

src/rule_with_actions.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ RuleWithActions::RuleWithActions(
8080
m_containsStaticBlockAction(false),
8181
m_isChained(false) {
8282

83+
if (transformations != NULL) {
84+
delete transformations;
85+
}
86+
8387
if (actions) {
8488
for (Action *a : *actions) {
8589
if (a->action_kind == Action::ConfigurationKind) {

test/cppcheck_suppressions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ danglingTempReference:src/modsecurity.cc:206
5555
knownConditionTrueFalse:src/operators/validate_url_encoding.cc:77
5656
knownConditionTrueFalse:src/operators/verify_svnr.cc:87
5757
rethrowNoCurrentException:headers/modsecurity/transaction.h:309
58-
rethrowNoCurrentException:src/rule_with_actions.cc:123
59-
ctunullpointer:src/rule_with_actions.cc:237
58+
rethrowNoCurrentException:src/rule_with_actions.cc:127
59+
ctunullpointer:src/rule_with_actions.cc:241
6060
ctunullpointer:src/rule_with_operator.cc:135
6161
ctunullpointer:src/rule_with_operator.cc:95
6262
passedByValue:src/variables/global.h:109

0 commit comments

Comments
 (0)