Mercurial > hg > octave-lojdl > gnulib-hg
changeset 14472:17beee3610b7
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>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Fri, 25 Mar 2011 10:45:39 -0600 |
parents | 00926d04a436 |
children | acd1454e6a45 |
files | ChangeLog lib/xmalloc.c |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-03-25 Eric Blake <eblake@redhat.com> + + 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). + 2011-03-25 Reuben Thomas <rrt@sc3d.org> maint.mk: add missing version to VC-tag
--- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -52,7 +52,7 @@ 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 @@ } p = realloc (p, n); - if (!p) + if (!p && n) xalloc_die (); return p; }