mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
Fix potential leak of Analyzers added to tree during Analyzer::Done
Credit to OSS-Fuzz for discovery https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22630
This commit is contained in:
parent
433e1154da
commit
d2eb701b7e
1 changed files with 14 additions and 0 deletions
|
@ -135,6 +135,20 @@ Analyzer::~Analyzer()
|
|||
{
|
||||
assert(finished);
|
||||
|
||||
// Make sure any late entries into the analyzer tree are handled (e.g.
|
||||
// from some Done() implementation).
|
||||
LOOP_OVER_GIVEN_CHILDREN(i, new_children)
|
||||
{
|
||||
if ( ! (*i)->finished )
|
||||
(*i)->Done();
|
||||
}
|
||||
|
||||
// Deletion of new_children done in separate loop in case a Done()
|
||||
// implementation tries to inspect analyzer tree w/ assumption that
|
||||
// all analyzers are still valid.
|
||||
LOOP_OVER_GIVEN_CHILDREN(i, new_children)
|
||||
delete *i;
|
||||
|
||||
LOOP_OVER_CHILDREN(i)
|
||||
delete *i;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue