FileAnalysis: fix access of invalidated std::map iterator.

This commit is contained in:
Jon Siwek 2013-03-26 15:52:12 -05:00
parent 497496ec83
commit 621fe51c82
2 changed files with 4 additions and 3 deletions

View file

@ -77,7 +77,7 @@ void Info::StaticInit()
} }
Info::Info(const string& unique, Connection* conn, AnalyzerTag::Tag tag) Info::Info(const string& unique, Connection* conn, AnalyzerTag::Tag tag)
: file_id(unique), unique(unique), val(0), postpone_timeout(false), : file_id(""), unique(unique), val(0), postpone_timeout(false),
need_reassembly(false), done(false), actions(this) need_reassembly(false), done(false), actions(this)
{ {
StaticInit(); StaticInit();
@ -338,13 +338,14 @@ void Info::DataIn(const u_char* data, uint64 len)
void Info::EndOfFile() void Info::EndOfFile()
{ {
if ( done ) return; if ( done ) return;
done = true;
actions.DrainModifications(); actions.DrainModifications();
// Send along anything that's been buffered, but never flushed. // Send along anything that's been buffered, but never flushed.
ReplayBOF(); ReplayBOF();
done = true;
Action* act = 0; Action* act = 0;
IterCookie* c = actions.InitForIteration(); IterCookie* c = actions.InitForIteration();

View file

@ -303,8 +303,8 @@ bool Manager::RemoveFile(const string& unique)
reporter->Error("No mapping for fileID %s", id.c_str()); reporter->Error("No mapping for fileID %s", id.c_str());
ignored.erase(unique); ignored.erase(unique);
str_map.erase(unique);
delete it->second; delete it->second;
str_map.erase(unique);
return true; return true;
} }