summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc/malloc.c')
-rw-r--r--libc/stdlib/malloc/malloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index 7bbd2726b..5f88cf48e 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -184,8 +184,13 @@ malloc (size_t size)
__heap_check (&__malloc_heap, "malloc");
#endif
+#if defined(__MALLOC_GLIBC_COMPAT__)
if (size == 0)
return 0;
+#else
+ if (size == 0)
+ size++;
+#endif
return malloc_from_heap (size, &__malloc_heap);
}