mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Fix mem leak in failing table initialization case.
Specifically that case looked like tables that have a compound index and an element assignment fails due to a type mismatch.
This commit is contained in:
parent
f823b92e5e
commit
0b5a75a463
1 changed files with 5 additions and 4 deletions
|
@ -2079,7 +2079,7 @@ int TableVal::ExpandCompoundAndInit(val_list* vl, int k, Val* new_val)
|
||||||
Val* ind_k_v = (*vl)[k];
|
Val* ind_k_v = (*vl)[k];
|
||||||
ListVal* ind_k = ind_k_v->Type()->IsSet() ?
|
ListVal* ind_k = ind_k_v->Type()->IsSet() ?
|
||||||
ind_k_v->AsTableVal()->ConvertToList() :
|
ind_k_v->AsTableVal()->ConvertToList() :
|
||||||
ind_k_v->AsListVal();
|
ind_k_v->Ref()->AsListVal();
|
||||||
|
|
||||||
for ( int i = 0; i < ind_k->Length(); ++i )
|
for ( int i = 0; i < ind_k->Length(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -2097,12 +2097,13 @@ int TableVal::ExpandCompoundAndInit(val_list* vl, int k, Val* new_val)
|
||||||
Unref(expd);
|
Unref(expd);
|
||||||
|
|
||||||
if ( ! success )
|
if ( ! success )
|
||||||
|
{
|
||||||
|
Unref(ind_k);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ind_k_v->Type()->IsSet() )
|
|
||||||
Unref(ind_k);
|
Unref(ind_k);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue