From 371fc03218efc205e8e42935c7d95b82c6047676 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Tue, 24 Oct 2017 00:01:44 -0300 Subject: [PATCH] Fix memory issue while changing rule target dynamic Issue #1590 --- CHANGES | 2 ++ src/rule.cc | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 00a2b256..34c9d1f7 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ v3.0.????? - ? --------------------------- + - Fix memory issue while changing rule target dynamic + [Issue #1590 - @zimmerle, @slabber] - Fix log while displaying the name of a dict selection by regex. [@zimmerle] - Setting http response code on the auditlog. diff --git a/src/rule.cc b/src/rule.cc index 83005eeb..afa079ff 100644 --- a/src/rule.cc +++ b/src/rule.cc @@ -447,10 +447,10 @@ std::vector> Rule::getFinalVars( std::vector z; a.second->evaluateInternal(trans, this, &z); for (auto &y : z) { - exclusions_update_by_tag_remove.push_back(y->m_key); + exclusions_update_by_tag_remove.push_back(std::string(y->m_key)); delete y; } - exclusions_update_by_tag_remove.push_back(a.second->m_name); + exclusions_update_by_tag_remove.push_back(std::string(a.second->m_name)); } else { Variable *b = a.second.get(); @@ -466,10 +466,10 @@ std::vector> Rule::getFinalVars( std::vector z; a.second->evaluateInternal(trans, this, &z); for (auto &y : z) { - exclusions_update_by_id_remove.push_back(y->m_key); + exclusions_update_by_id_remove.push_back(std::string(y->m_key)); delete y; } - exclusions_update_by_id_remove.push_back(a.second->m_name); + exclusions_update_by_id_remove.push_back(std::string(a.second->m_name)); } else { Variable *b = a.second.get(); variables.push_back(b); @@ -482,10 +482,10 @@ std::vector> Rule::getFinalVars( std::vector z; variable->evaluateInternal(trans, this, &z); for (auto &y : z) { - exclusions.push_back(y->m_key); + exclusions.push_back(std::string(y->m_key)); delete y; } - exclusions.push_back(variable->m_name); + exclusions.push_back(std::string(variable->m_name)); } }