Merge pull request #10992 from Atlante45/fix/heap-use-after-free

Fix potential data corruption in the FileCache
This commit is contained in:
Clément Brisset 2017-07-19 10:44:02 -07:00 committed by GitHub
commit d76039387a
2 changed files with 3 additions and 2 deletions

View file

@ -258,7 +258,8 @@ namespace cache {
};
}
void FileCache::eject(const FilePointer& file) {
// Take file pointer by value to insure it doesn't get destructed during the "erase()" calls
void FileCache::eject(FilePointer file) {
file->_locked = false;
const auto& length = file->getLength();
const auto& key = file->getKey();

View file

@ -119,7 +119,7 @@ private:
void clean();
void clear();
// Remove a file from the cache
void eject(const FilePointer& file);
void eject(FilePointer file);
size_t getOverbudgetAmount() const;