From 0355ae967feefd5811ddf4c37d91e43fff880a13 Mon Sep 17 00:00:00 2001 From: Florian Born Date: Wed, 20 Apr 2022 17:57:03 +0200 Subject: [PATCH] compile fix on other platforms --- code/Common/StackAllocator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/Common/StackAllocator.cpp b/code/Common/StackAllocator.cpp index c789099a2..259a565be 100644 --- a/code/Common/StackAllocator.cpp +++ b/code/Common/StackAllocator.cpp @@ -59,7 +59,7 @@ void *StackAllocator::Allocate(size_t byteSize) { // double block size every time, up to maximum of g_maxBytesPerBlock. // Block size must be at least as large as byteSize, but we want to use this for small allocations anyway. m_blockAllocationSize = std::max(std::min(m_blockAllocationSize * 2, g_maxBytesPerBlock), byteSize); - uint8_t *data = (uint8_t *)malloc(m_blockAllocationSize); + uint8_t *data = new uint8_t[m_blockAllocationSize]; m_storageBlocks.push_back(data); m_subIndex = byteSize; return data; @@ -74,7 +74,7 @@ void *StackAllocator::Allocate(size_t byteSize) { void StackAllocator::FreeAll() { for (size_t i = 0; i < m_storageBlocks.size(); i++) { - free(m_storageBlocks[i]); + delete [] m_storageBlocks[i]; } std::deque empty; m_storageBlocks.swap(empty);