diff options
author | Yan Wang <yawanng@google.com> | 2020-05-20 17:58:49 +0000 |
---|---|---|
committer | Yan Wang <yawanng@google.com> | 2020-05-20 17:58:49 +0000 |
commit | 5d84cc96cb8f86333bc8435e53ee1f35cb317f2f (patch) | |
tree | c472660f7b64cbc4c7e437c0bb778995562937d0 | |
parent | 8fb0f52466ab5d3b1ef1589311e91fbba8e60a81 (diff) | |
download | iorap-5d84cc96cb8f86333bc8435e53ee1f35cb317f2f.tar.gz |
session: Fix a use-after-free bug.
The iterator is acceessed after remove.
Bug: 147325546
Test: Make
Change-Id: Ib29e3fe01768aac60cb1612a67a7caf57ed7010c
-rw-r--r-- | src/prefetcher/session.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/prefetcher/session.cc b/src/prefetcher/session.cc index 79947b0..e998580 100644 --- a/src/prefetcher/session.cc +++ b/src/prefetcher/session.cc @@ -591,9 +591,10 @@ void SessionDirect::Dump(std::ostream& os, bool multiline) const { } SessionDirect::~SessionDirect() { - for (auto it = entry_list_map_.begin(); it != entry_list_map_.end(); ++it) { + for (auto it = entry_list_map_.begin(); it != entry_list_map_.end();) { size_t path_id = it->first; + ++it; // the iterator is removed in the following Unregister method. UnregisterFilePath(path_id); } } |