From c269f57d321991998a0aa5cc482c7e0124ccd45f Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 9 Apr 2015 13:47:06 -0500 Subject: return NULL for realloc(p,0) like glibc See discussion here about the issue: https://sourceware.org/bugzilla/show_bug.cgi?id=12547 Fixes testsuite errors. --- libc/stdlib/malloc/realloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 8de00665f..8d55289c5 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -30,7 +30,7 @@ realloc (void *mem, size_t new_size) if (! new_size) { free (mem); - return malloc (new_size); + return NULL; } if (! mem) return malloc (new_size); -- cgit v1.2.3