Don't crash on xrealloc(0) (found by Jon Griffiths).
This commit is contained in:
parent
7ff344e20f
commit
b98d045e02
|
@ -45,7 +45,7 @@ void *xmalloc (size_t size)
|
|||
void *xrealloc (void *ptr, size_t size)
|
||||
{
|
||||
void *res = realloc (ptr, size);
|
||||
if (res == NULL)
|
||||
if (size && res == NULL)
|
||||
{
|
||||
fprintf (stderr, "Virtual memory exhausted.\n");
|
||||
exit (1);
|
||||
|
|
Loading…
Reference in New Issue