mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Fix invalid iterator usage in Application::close_XML_File
The iterator 'b' is invalidated by calling erase(b), which means that the subsequent call to ++b results in undefined behavior. This was identified by segfaults in the Matlab unit test on OS X.
This commit is contained in:
@@ -306,8 +306,8 @@ void Application::close_XML_File(const std::string& file)
|
||||
for (; b != e; ++b) {
|
||||
b->second.first->unlock();
|
||||
delete b->second.first;
|
||||
xmlfiles.erase(b->first);
|
||||
}
|
||||
xmlfiles.clear();
|
||||
} else if (xmlfiles.find(file) != xmlfiles.end()) {
|
||||
xmlfiles[file].first->unlock();
|
||||
delete xmlfiles[file].first;
|
||||
|
||||
Reference in New Issue
Block a user