From 6863cd30387cc3dd63f1eeb865d31274f6777c94 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 16 Sep 2024 13:18:57 -0400 Subject: [PATCH] runtime_loader: Add calloc() to heap implementation. Taken from the bootloader's version, which this heap is based on. --- src/system/runtime_loader/heap.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/system/runtime_loader/heap.cpp b/src/system/runtime_loader/heap.cpp index fe88578338..d108892a79 100644 --- a/src/system/runtime_loader/heap.cpp +++ b/src/system/runtime_loader/heap.cpp @@ -412,6 +412,17 @@ realloc(void* oldBuffer, size_t newSize) } +void* +calloc(size_t numElements, size_t size) +{ + void* address = malloc(numElements * size); + if (address != NULL) + memset(address, 0, numElements * size); + + return address; +} + + void free(void* allocated) {