Merge remote-tracking branch 'origin/topic/jsiwek/fix-expire-func-leaks'

* origin/topic/jsiwek/fix-expire-func-leaks:
  Fix memory leaks in expire_func introduced by recent changes
This commit is contained in:
Robin Sommer 2019-07-30 18:12:49 +00:00
commit bae60aee31
3 changed files with 16 additions and 8 deletions

View file

@ -1,4 +1,9 @@
2.6-713 | 2019-07-30 18:12:49 +0000
* Fix memory leaks in expire_func introduced by recent changes (Jon
Siwek, Corelight)
2.6-711 | 2019-07-29 20:15:27 -0700 2.6-711 | 2019-07-29 20:15:27 -0700
* Fix duplicate TCP packets not being detected as retransmissions (Jeff Barber) * Fix duplicate TCP packets not being detected as retransmissions (Jeff Barber)

View file

@ -1 +1 @@
2.6-711 2.6-713

View file

@ -2339,24 +2339,27 @@ double TableVal::CallExpireFunc(Val* idx)
{ {
if ( ! any_idiom ) if ( ! any_idiom )
{ {
const val_list* vl0 = idx->AsListVal()->Vals();
for ( const auto& v : *idx->AsListVal()->Vals() ) for ( const auto& v : *idx->AsListVal()->Vals() )
vl.append(v->Ref()); vl.append(v->Ref());
Unref(idx);
} }
else else
{ {
ListVal* idx_list = idx->AsListVal(); ListVal* idx_list = idx->AsListVal();
// Flatten if only one element // Flatten if only one element
if ( idx_list->Length() == 1 ) if ( idx_list->Length() == 1 )
idx = idx_list->Index(0); {
Val* old = idx;
idx = idx_list->Index(0)->Ref();
Unref(old);
}
vl.append(idx->Ref()); vl.append(idx);
} }
} }
else else
{ vl.append(idx);
vl.append(idx->Ref());
}
Val* result = 0; Val* result = 0;