mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix iterator invalidation in broker::Manager dtor.
This commit is contained in:
parent
8bd38c2788
commit
63ab936d8c
3 changed files with 15 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue