mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
fix memory leak in tables and vectors that are read into tables
This commit is contained in:
parent
62519f4408
commit
a5cc98bb5d
1 changed files with 6 additions and 1 deletions
|
@ -1795,8 +1795,12 @@ Val* Manager::ValueToVal(const Value* val, BroType* request_type) {
|
|||
SetType* s = new SetType(set_index, 0);
|
||||
TableVal* t = new TableVal(s);
|
||||
for ( int i = 0; i < val->val.set_val.size; i++ ) {
|
||||
t->Assign(ValueToVal( val->val.set_val.vals[i], type ), 0);
|
||||
Val* assignval = ValueToVal( val->val.set_val.vals[i], type );
|
||||
t->Assign(assignval, 0);
|
||||
Unref(assignval); // idex is not consumed by assign.
|
||||
}
|
||||
|
||||
Unref(s);
|
||||
return t;
|
||||
break;
|
||||
}
|
||||
|
@ -1809,6 +1813,7 @@ Val* Manager::ValueToVal(const Value* val, BroType* request_type) {
|
|||
for ( int i = 0; i < val->val.vector_val.size; i++ ) {
|
||||
v->Assign(i, ValueToVal( val->val.set_val.vals[i], type ), 0);
|
||||
}
|
||||
Unref(vt);
|
||||
return v;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue