mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
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:
commit
bae60aee31
3 changed files with 16 additions and 8 deletions
17
src/Val.cc
17
src/Val.cc
|
@ -2339,24 +2339,27 @@ double TableVal::CallExpireFunc(Val* idx)
|
|||
{
|
||||
if ( ! any_idiom )
|
||||
{
|
||||
const val_list* vl0 = idx->AsListVal()->Vals();
|
||||
for ( const auto& v : *idx->AsListVal()->Vals() )
|
||||
vl.append(v->Ref());
|
||||
|
||||
Unref(idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListVal* idx_list = idx->AsListVal();
|
||||
// Flatten if only one element
|
||||
if (idx_list->Length() == 1)
|
||||
idx = idx_list->Index(0);
|
||||
if ( idx_list->Length() == 1 )
|
||||
{
|
||||
Val* old = idx;
|
||||
idx = idx_list->Index(0)->Ref();
|
||||
Unref(old);
|
||||
}
|
||||
|
||||
vl.append(idx->Ref());
|
||||
vl.append(idx);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vl.append(idx->Ref());
|
||||
}
|
||||
vl.append(idx);
|
||||
|
||||
Val* result = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue