diff options
author | Eric Blake <eblake@redhat.com> | 2011-03-25 10:45:39 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-03-25 10:45:39 -0600 |
commit | ac165f4522adce39e471f2dc4b3fc812f8c8892f (patch) | |
tree | 4cb2f332192fae0f11891edaf3340d8b7eb42db4 /lib/xmalloc.c | |
parent | ecfe2457598e535434706928c9be913030729bee (diff) | |
download | gnulib-ac165f4522adce39e471f2dc4b3fc812f8c8892f.tar.gz |
xmalloc: revert yesterday's regression
* lib/xmalloc.c (xrealloc): Once again forward xrealloc(NULL,0) to
realloc's underlying behavior (allowing allocation of zero-size
objects, especially if malloc-gnu is also in use).
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'lib/xmalloc.c')
-rw-r--r-- | lib/xmalloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 4589e7d74e..08c30fb8a3 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -52,7 +52,7 @@ xmalloc (size_t n) void * xrealloc (void *p, size_t n) { - if (!n) + if (!n && p) { /* The GNU and C99 realloc behaviors disagree here. Act like GNU, even if the underlying realloc is C99. */ @@ -61,7 +61,7 @@ xrealloc (void *p, size_t n) } p = realloc (p, n); - if (!p) + if (!p && n) xalloc_die (); return p; } |