Skip to content

Commit

Permalink
[XrdSciTokens] Modifying std::map invalidates iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
jthiltges committed Dec 13, 2021
1 parent d9c52f3 commit 5d165e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/XrdSciTokens/XrdSciTokensAccess.cc
Expand Up @@ -959,9 +959,11 @@ class XrdAccSciTokens : public XrdAccAuthorize, public XrdSciTokensHelper
if (now <= m_next_clean) {return;}
std::lock_guard<std::mutex> guard(m_mutex);

for (auto iter = m_map.begin(); iter != m_map.end(); iter++) {
for (auto iter = m_map.begin(); iter != m_map.end(); ) {
if (iter->second->expired()) {
m_map.erase(iter);
iter = m_map.erase(iter);
} else {
++iter;
}
}
Reconfig();
Expand Down

0 comments on commit 5d165e1

Please sign in to comment.