Removes memory leak on the counter variable modificator

This commit is contained in:
Felipe Zimmerle 2017-05-28 22:10:30 -03:00
parent c49688fd7d
commit e1d3abc8e7
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -131,9 +131,15 @@ class VariableModificatorCount : public Variable {
int count = 0;
m_var->evaluate(transaction, rule, &reslIn);
for (auto &a : reslIn) {
for (const collection::Variable *a : reslIn) {
count++;
if (a->m_dynamic) {
delete a;
a = NULL;
}
}
reslIn.clear();
res = new std::string(std::to_string(count));
val = new collection::Variable(&m_name, res);