Fix memory alignment

This commit is contained in:
Alexander Batalov 2022-10-29 17:26:46 +03:00
parent 8dd8d1c312
commit 2b63360b95
1 changed files with 2 additions and 0 deletions

View File

@ -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);