streamline mutex unlock to remove a useless branch, use a_store to unlock
[musl] / src / malloc / __simple_malloc.c
index 61cd9fc..c829390 100644 (file)
@@ -15,6 +15,7 @@ void *__simple_malloc(size_t n)
        static int lock;
        size_t align=1;
 
+       if (!n) n++;
        if (n > SIZE_MAX/2) goto toobig;
 
        while (align<n && align<ALIGN)