From 6d86516ffb679d8da6cef4ed270b7edde1885dd9 Mon Sep 17 00:00:00 2001 From: shchmue Date: Fri, 25 Oct 2019 21:58:00 -0600 Subject: [PATCH] heap: Fix calloc memset size --- bootloader/mem/heap.c | 2 +- nyx/nyx_gui/mem/heap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bootloader/mem/heap.c b/bootloader/mem/heap.c index fd46c16..38ca7d2 100644 --- a/bootloader/mem/heap.c +++ b/bootloader/mem/heap.c @@ -114,7 +114,7 @@ void *malloc(u32 size) void *calloc(u32 num, u32 size) { void *res = (void *)_heap_alloc(&_heap, num * size, sizeof(hnode_t)); - memset(res, 0, num * size); + memset(res, 0, ALIGN(num * size, sizeof(hnode_t))); return res; } diff --git a/nyx/nyx_gui/mem/heap.c b/nyx/nyx_gui/mem/heap.c index 0c49de3..a56bef3 100644 --- a/nyx/nyx_gui/mem/heap.c +++ b/nyx/nyx_gui/mem/heap.c @@ -114,7 +114,7 @@ void *malloc(u32 size) void *calloc(u32 num, u32 size) { void *res = (void *)_heap_alloc(&_heap, num * size, sizeof(hnode_t)); - memset(res, 0, num * size); + memset(res, 0, ALIGN(num * size, sizeof(hnode_t))); return res; }