mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-18 06:31:02 +00:00
COMMON: Fix mismatched new/delete in the MemoryPool class
Memory is allocated with new in Hashmap::allocNode() and incorrectly freed with free() in ~MemoryPool() and freeUnusedPages(). Issue reported by Dr. Memory
This commit is contained in:
parent
9466f57978
commit
b585addc23
@ -56,7 +56,7 @@ MemoryPool::~MemoryPool() {
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < _pages.size(); ++i)
|
||||
::free(_pages[i].start);
|
||||
delete _pages[i].start;
|
||||
}
|
||||
|
||||
void MemoryPool::allocPage() {
|
||||
@ -152,7 +152,7 @@ void MemoryPool::freeUnusedPages() {
|
||||
iter2 = *(void ***)iter2;
|
||||
}
|
||||
|
||||
::free(_pages[i].start);
|
||||
delete _pages[i].start;
|
||||
++freedPagesCount;
|
||||
_pages[i].start = NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user