From 5b151634a5136945609e2c5adb5ab951b37f636e Mon Sep 17 00:00:00 2001 From: sonilyan <286258386@qq.com> Date: Tue, 25 Oct 2022 14:12:54 +0800 Subject: [PATCH] Fix memory alignment (#187) --- src/heap.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/heap.cc b/src/heap.cc index 51236c2..e4a61f6 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -307,6 +307,8 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4) int blockSize; HeapHandle* handle; + size += 4 - size % 4; + if (heap == NULL || handleIndexPtr == NULL || size == 0) { goto err; }