Skip to content

Commit

Permalink
wutmalloc: Always align allocated memory to 0x40 to match newlib beha…
Browse files Browse the repository at this point in the history
…viour
  • Loading branch information
Maschell authored and WinterMute committed Apr 17, 2023
1 parent 04b2eaf commit 0c316f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/wutmalloc/wut_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ __fini_wut_malloc(void)
void *
_malloc_r(struct _reent *r, size_t size)
{
void *ptr = MEMAllocFromDefaultHeap(size);
void *ptr = MEMAllocFromDefaultHeapEx(size, 0x40);
if (!ptr) {
r->_errno = ENOMEM;
}
Expand All @@ -36,7 +36,7 @@ _free_r(struct _reent *r, void *ptr)
void *
_realloc_r(struct _reent *r, void *ptr, size_t size)
{
void *new_ptr = MEMAllocFromDefaultHeap(size);
void *new_ptr = MEMAllocFromDefaultHeapEx(size, 0x40);
if (!new_ptr) {
r->_errno = ENOMEM;
return new_ptr;
Expand All @@ -53,7 +53,7 @@ _realloc_r(struct _reent *r, void *ptr, size_t size)
void *
_calloc_r(struct _reent *r, size_t num, size_t size)
{
void *ptr = MEMAllocFromDefaultHeap(num * size);
void *ptr = MEMAllocFromDefaultHeapEx(num * size, 0x40);
if (ptr) {
memset(ptr, 0, num * size);
} else {
Expand Down

0 comments on commit 0c316f5

Please sign in to comment.