Fix file analyzer memory management.

File analyzers got deleted immediately once the queue with the
corresponding removal operation got drained. That however can happen
while the analyzer is still doing stuff: the queue is drained whenever
any the "special" file analysis events needing immediate attention has
been executed. This fix now only schedules the analyzer for deletion
at that time, but postpones the actual operation until file object
itself is being destroyed.
This commit is contained in:
Robin Sommer 2017-01-28 11:45:49 -08:00
parent 572c9b49fd
commit 3ce6a031d4
3 changed files with 18 additions and 1 deletions

View file

@ -130,7 +130,10 @@ bool AnalyzerSet::Remove(file_analysis::Tag tag, HashKey* key)
file_mgr->GetComponentName(tag).c_str());
a->Done();
delete a;
// We don't delete the analyze object right here because the remove
// operation may execute when that will still be accessed.
file->DoneWithAnalyzer(a);
return true;
}