* 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>
+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
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. */
}
p = realloc (p, n);
- if (!p)
+ if (!p && n)
xalloc_die ();
return p;
}