From e28fa2f552fd58264ecff1307a1e61818ded080f Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 13 Nov 2023 09:31:37 -0500 Subject: [PATCH] Fix #418, memory alignment in PCS_malloc stub Correct the round-up memory alignment calculation in the stub "malloc" routine. --- unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c index d6fbdffe..c8923014 100644 --- a/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c +++ b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c @@ -143,7 +143,7 @@ void *PCS_malloc(size_t sz) return NULL; } - NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN); + NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN - 1); NextBlock = Rec->BlockAddr + MPOOL_ALIGN; Rec->BlockAddr += NextSize; Rec->Size += NextSize;