Skip to content

Commit

Permalink
fix use after free in index_lock (#546)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Chernyshov <alexey.n.chernyshov@gmail.com>
  • Loading branch information
Alexey-N-Chernyshov authored Dec 3, 2021
1 parent e59a5b3 commit 5fcc3bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/sector_storage/stores/impl/index_lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ namespace fc::sector_storage::stores {
}
sector.write = static_cast<SectorFileType>(sector.write & ~lock.write);
--sector.refs;
sector.cv.notify_all();
sector_lock.unlock();
if (!sector.refs) {
sectors.erase(lock.sector);
}
sector.cv.notify_all();
}
} // namespace fc::sector_storage::stores

0 comments on commit 5fcc3bb

Please sign in to comment.