Skip to content

Commit 371fc03

Browse files
author
Felipe Zimmerle
committed
Fix memory issue while changing rule target dynamic
Issue #1590
1 parent 351beb0 commit 371fc03

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
v3.0.????? - ?
33
---------------------------
44

5+
- Fix memory issue while changing rule target dynamic
6+
[Issue #1590 - @zimmerle, @slabber]
57
- Fix log while displaying the name of a dict selection by regex.
68
[@zimmerle]
79
- Setting http response code on the auditlog.

src/rule.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,10 @@ std::vector<std::unique_ptr<collection::Variable>> Rule::getFinalVars(
447447
std::vector<const collection::Variable *> z;
448448
a.second->evaluateInternal(trans, this, &z);
449449
for (auto &y : z) {
450-
exclusions_update_by_tag_remove.push_back(y->m_key);
450+
exclusions_update_by_tag_remove.push_back(std::string(y->m_key));
451451
delete y;
452452
}
453-
exclusions_update_by_tag_remove.push_back(a.second->m_name);
453+
exclusions_update_by_tag_remove.push_back(std::string(a.second->m_name));
454454

455455
} else {
456456
Variable *b = a.second.get();
@@ -466,10 +466,10 @@ std::vector<std::unique_ptr<collection::Variable>> Rule::getFinalVars(
466466
std::vector<const collection::Variable *> z;
467467
a.second->evaluateInternal(trans, this, &z);
468468
for (auto &y : z) {
469-
exclusions_update_by_id_remove.push_back(y->m_key);
469+
exclusions_update_by_id_remove.push_back(std::string(y->m_key));
470470
delete y;
471471
}
472-
exclusions_update_by_id_remove.push_back(a.second->m_name);
472+
exclusions_update_by_id_remove.push_back(std::string(a.second->m_name));
473473
} else {
474474
Variable *b = a.second.get();
475475
variables.push_back(b);
@@ -482,10 +482,10 @@ std::vector<std::unique_ptr<collection::Variable>> Rule::getFinalVars(
482482
std::vector<const collection::Variable *> z;
483483
variable->evaluateInternal(trans, this, &z);
484484
for (auto &y : z) {
485-
exclusions.push_back(y->m_key);
485+
exclusions.push_back(std::string(y->m_key));
486486
delete y;
487487
}
488-
exclusions.push_back(variable->m_name);
488+
exclusions.push_back(std::string(variable->m_name));
489489
}
490490
}
491491

0 commit comments

Comments
 (0)