Skip to content

Commit e9a7ba4

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

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

CHANGES

+2
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

+2
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

+4
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

+6-2
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
@@ -93,6 +93,10 @@ functionStatic
9393
variableScope
9494
shadowFunction
9595

96+
constVariable
97+
stlcstrConstructor
98+
stlcstrStream
99+
uselessCallsSubstr
96100

97101
// Examples
98102
memleak:examples/reading_logs_via_rule_message/reading_logs_via_rule_message.h:147

0 commit comments

Comments
 (0)