From 5851ae5309dbd77d2b408a6a0c825bbe52f0ac2f Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Wed, 10 Oct 2018 20:24:51 +0200 Subject: [PATCH] Fix issue in PoolAllocator: Use default base allocator instead of free() --- src/memory/DefaultPoolAllocator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory/DefaultPoolAllocator.cpp b/src/memory/DefaultPoolAllocator.cpp index 5d4f4ff0..39f84eee 100644 --- a/src/memory/DefaultPoolAllocator.cpp +++ b/src/memory/DefaultPoolAllocator.cpp @@ -135,9 +135,9 @@ void* DefaultPoolAllocator::allocate(size_t size) { MemoryBlock* currentMemoryBlocks = mMemoryBlocks; mNbAllocatedMemoryBlocks += 64; mMemoryBlocks = static_cast(MemoryManager::getBaseAllocator().allocate(mNbAllocatedMemoryBlocks * sizeof(MemoryBlock))); - memcpy(mMemoryBlocks, currentMemoryBlocks,mNbCurrentMemoryBlocks * sizeof(MemoryBlock)); + memcpy(mMemoryBlocks, currentMemoryBlocks, mNbCurrentMemoryBlocks * sizeof(MemoryBlock)); memset(mMemoryBlocks + mNbCurrentMemoryBlocks, 0, 64 * sizeof(MemoryBlock)); - free(currentMemoryBlocks); + MemoryManager::getBaseAllocator().release(currentMemoryBlocks, mNbCurrentMemoryBlocks * sizeof(MemoryBlock)); } // Allocate a new memory blocks for the corresponding heap and divide it in many