From 2b63360b95b3614f06108229c93129f098022630 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 29 Oct 2022 17:26:46 +0300 Subject: [PATCH] Fix memory alignment --- src/memory.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/memory.cc b/src/memory.cc index 75e9ca9..5f15047 100644 --- a/src/memory.cc +++ b/src/memory.cc @@ -81,6 +81,7 @@ static void* memoryBlockMallocImpl(size_t size) if (size != 0) { size += sizeof(MemoryBlockHeader) + sizeof(MemoryBlockFooter); + size += sizeof(int) - size % sizeof(int); unsigned char* block = (unsigned char*)malloc(size); if (block != NULL) { @@ -123,6 +124,7 @@ static void* memoryBlockReallocImpl(void* ptr, size_t size) if (size != 0) { size += sizeof(MemoryBlockHeader) + sizeof(MemoryBlockFooter); + size += sizeof(int) - size % sizeof(int); } unsigned char* newBlock = (unsigned char*)realloc(block, size);