diff --git a/src/file_analysis/Manager.cc b/src/file_analysis/Manager.cc index 3f04ebfc2b..393dadfdc7 100644 --- a/src/file_analysis/Manager.cc +++ b/src/file_analysis/Manager.cc @@ -27,7 +27,22 @@ Manager::Manager() Manager::~Manager() { - Terminate(); + // Have to assume that too much of Bro has been shutdown by this point + // to do anything more than reclaim memory. + + File* f; + bool* b; + + IterCookie* it = id_map.InitForIteration(); + + while ( (f = id_map.NextEntry(it)) ) + delete f; + + it = ignored.InitForIteration(); + + while( (b = ignored.NextEntry(it)) ) + delete b; + delete magic_state; } @@ -58,10 +73,15 @@ void Manager::Terminate() HashKey* key; while ( id_map.NextEntry(key, it) ) + { keys.push_back(static_cast(key->Key())); + delete key; + } for ( size_t i = 0; i < keys.size(); ++i ) Timeout(keys[i], true); + + mgr.Drain(); } string Manager::HashHandle(const string& handle) const diff --git a/src/main.cc b/src/main.cc index cf1f82b1eb..10b66083a8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -379,10 +379,10 @@ void terminate_bro() delete secondary_path; delete remote_serializer; delete analyzer_mgr; + delete file_mgr; delete log_mgr; delete plugin_mgr; delete thread_mgr; - delete file_mgr; delete reporter; reporter = 0;