Fix iterator invalidation in broker::Manager dtor.

This commit is contained in:
Jon Siwek 2015-04-13 10:34:42 -05:00
parent 8bd38c2788
commit 63ab936d8c
3 changed files with 15 additions and 3 deletions

View file

@ -1,4 +1,10 @@
2.3-695 | 2015-04-13 10:34:42 -0500
* Fix iterator invalidation in broker::Manager dtor. (Jon Siwek)
* Add paragraph to plugin documentation. (Robin Sommer)
2.3-693 | 2015-04-11 10:56:31 -0700
* BIT-1367: improve coercion of anonymous records in set constructor.
@ -6,7 +12,6 @@
* Allow to specify ports for sftp log rotator. (Johanna Amann)
2.3-690 | 2015-04-10 21:51:10 -0700
* Make sure to always delete the remote serializer. Addresses

View file

@ -1 +1 @@
2.3-693
2.3-695

View file

@ -26,8 +26,15 @@ int bro_broker::Manager::send_flags_unsolicited_idx;
bro_broker::Manager::~Manager()
{
vector<decltype(data_stores)::key_type> stores_to_close;
for ( auto& s : data_stores )
CloseStore(s.first.first, s.first.second);
stores_to_close.emplace_back(s.first);
for ( auto& s : stores_to_close )
// This doesn't loop directly over data_stores, because CloseStore
// modifies the map and invalidates iterators.
CloseStore(s.first, s.second);
}
static int require_field(RecordType* rt, const char* name)