mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
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:
parent
572c9b49fd
commit
3ce6a031d4
3 changed files with 18 additions and 1 deletions
|
@ -107,6 +107,9 @@ File::~File()
|
|||
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Destroying File object", id.c_str());
|
||||
Unref(val);
|
||||
delete file_reassembler;
|
||||
|
||||
for ( auto a : done_analyzers )
|
||||
delete a;
|
||||
}
|
||||
|
||||
void File::UpdateLastActivityTime()
|
||||
|
@ -478,6 +481,11 @@ void File::DeliverChunk(const u_char* data, uint64 len, uint64 offset)
|
|||
EndOfFile();
|
||||
}
|
||||
|
||||
void File::DoneWithAnalyzer(Analyzer* analyzer)
|
||||
{
|
||||
done_analyzers.push_back(analyzer);
|
||||
}
|
||||
|
||||
void File::DataIn(const u_char* data, uint64 len, uint64 offset)
|
||||
{
|
||||
analyzers.DrainModifications();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue