diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-03-18 14:34:37 +0100 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-03-18 14:34:37 +0100 |
commit | 72580516bb70627b3cfaf196f582b597834f1763 (patch) | |
tree | 876f006bea6dae700fe6a28ebf54f84096b3b583 | |
parent | 80615f6bfea128e1377145e1087eb4bd34ca8983 (diff) | |
download | ceph-72580516bb70627b3cfaf196f582b597834f1763.tar.gz |
test/filestore/test_idempotent.cc: fix ~TestFileStoreState()
Fix interator handling in ~TestFileStoreState(). After std::map::erase()
the used iterator is invalid. Use a while-loop and erase the object with
post-incremented iterator instead.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
-rw-r--r-- | src/test/filestore/TestFileStoreState.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/filestore/TestFileStoreState.h b/src/test/filestore/TestFileStoreState.h index 74276b03f70..d3bba692437 100644 --- a/src/test/filestore/TestFileStoreState.h +++ b/src/test/filestore/TestFileStoreState.h @@ -99,10 +99,10 @@ public: } ~TestFileStoreState() { map<int, coll_entry_t*>::iterator it = m_collections.begin(); - for (; it != m_collections.end(); it++) { - if (it->second) - delete it->second; - m_collections.erase(it); + while (it != m_collections.end()) { + if (it->second) + delete it->second; + m_collections.erase(it++); } } |