mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
Merge pull request #10992 from Atlante45/fix/heap-use-after-free
Fix potential data corruption in the FileCache
This commit is contained in:
commit
d76039387a
2 changed files with 3 additions and 2 deletions
|
@ -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;
|
file->_locked = false;
|
||||||
const auto& length = file->getLength();
|
const auto& length = file->getLength();
|
||||||
const auto& key = file->getKey();
|
const auto& key = file->getKey();
|
||||||
|
|
|
@ -119,7 +119,7 @@ private:
|
||||||
void clean();
|
void clean();
|
||||||
void clear();
|
void clear();
|
||||||
// Remove a file from the cache
|
// Remove a file from the cache
|
||||||
void eject(const FilePointer& file);
|
void eject(FilePointer file);
|
||||||
|
|
||||||
size_t getOverbudgetAmount() const;
|
size_t getOverbudgetAmount() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue