diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-02-20 16:12:09 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-02-20 16:12:09 -0500 |
commit | 598a0147cde14d093d17b81c102a1757b5ef9975 (patch) | |
tree | bf059dc5799ed7fb3e31f535b33baac2e492e90f /src | |
parent | a23baf586a1ca78213d43bce5fee2a30715b473b (diff) | |
download | musl-598a0147cde14d093d17b81c102a1757b5ef9975.tar.gz musl-598a0147cde14d093d17b81c102a1757b5ef9975.tar.xz musl-598a0147cde14d093d17b81c102a1757b5ef9975.zip |
fix simple_malloc malloc(0) behavior not to return non-unique pointers
Diffstat (limited to 'src')
-rw-r--r-- | src/malloc/__simple_malloc.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/malloc/__simple_malloc.c b/src/malloc/__simple_malloc.c index 61cd9fc4..c029342c 100644 --- a/src/malloc/__simple_malloc.c +++ b/src/malloc/__simple_malloc.c @@ -15,6 +15,7 @@ void *__simple_malloc(size_t n) static int lock; size_t align=1; + if (!n) return 0; if (n > SIZE_MAX/2) goto toobig; while (align<n && align<ALIGN) |