summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc-standard
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc-standard')
-rw-r--r--libc/stdlib/malloc-standard/malloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/stdlib/malloc-standard/malloc.c b/libc/stdlib/malloc-standard/malloc.c
index 51e02a240..7025e8335 100644
--- a/libc/stdlib/malloc-standard/malloc.c
+++ b/libc/stdlib/malloc-standard/malloc.c
@@ -827,6 +827,10 @@ void* malloc(size_t bytes)
mchunkptr bck; /* misc temp for linking */
void * sysmem;
+#if !defined(__MALLOC_GLIBC_COMPAT__)
+ if (!bytes) return NULL;
+#endif
+
LOCK;
av = get_malloc_state();
/*