From d5c2df73659202e0ac7d024c9381e486c87ab3a8 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 21 Sep 2025 13:26:33 +0200 Subject: [PATCH] ulib dlmalloc Add page-aligned increment --- ulib/dlmalloc/dlmalloc_port.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ulib/dlmalloc/dlmalloc_port.inc b/ulib/dlmalloc/dlmalloc_port.inc index b5c7fa2..8ead8fb 100644 --- a/ulib/dlmalloc/dlmalloc_port.inc +++ b/ulib/dlmalloc/dlmalloc_port.inc @@ -72,11 +72,11 @@ void *sbrk(ptrdiff_t inc) { uint64_t pages = _roundpage(inc); uint8_t *maddr = NULL; int32_t ret = mman_map(NULL, pages, MMAN_MAP_PF_RW, 0, &maddr); - if (ret != E_OK) { + if (ret != E_OK || maddr == NULL) { return 0; } string_memset(maddr, 0, pages); - _last = (void *)(maddr + inc); + _last = (void *)(maddr + pages); return maddr; }