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

@ -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();