mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Fix memory leak due to enum type/val circular references
Introduced in 2982765128
This commit is contained in:
parent
2e2f611df5
commit
49a30d61cf
7 changed files with 15 additions and 6 deletions
|
@ -1714,7 +1714,12 @@ bool EnumType::DoUnserialize(UnserialInfo* info)
|
|||
|
||||
names[name] = val;
|
||||
delete [] name; // names[name] converts to std::string
|
||||
vals[val] = new EnumVal(this, val);
|
||||
// note: the 'vals' map gets populated lazily, which works fine and
|
||||
// also happens to avoid a leak due to circular reference between the
|
||||
// types and vals (there's a special case for unserializing a known
|
||||
// type that will unserialze and then immediately want to unref the
|
||||
// type if we already have it, except that won't delete it as intended
|
||||
// if we've already created circular references to it here).
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue