Fixed other instances of the xrealloc(0) bug.

oldstable
Alexandre Julliard 2005-03-18 14:09:55 +00:00
parent f65e415d64
commit b30d92dfb2
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ void *xrealloc (void *op, size_t len)
{ {
void *p = realloc (op, len); void *p = realloc (op, len);
if (!p) report (R_FATAL, "Out of memory."); if (len && !p) report (R_FATAL, "Out of memory.");
return p; return p;
} }

View File

@ -60,8 +60,8 @@ void* xmalloc(size_t size)
void *xrealloc(void* p, size_t size) void *xrealloc(void* p, size_t size)
{ {
void* p2; void* p2 = realloc (p, size);
if ((p2 = realloc (p, size)) == NULL) if (size && !p2)
error("Can not realloc %d bytes.", size); error("Can not realloc %d bytes.", size);
return p2; return p2;