Commit b98d045e authored by Alexandre Julliard's avatar Alexandre Julliard

Don't crash on xrealloc(0) (found by Jon Griffiths).

parent 7ff344e2
...@@ -45,7 +45,7 @@ void *xmalloc (size_t size) ...@@ -45,7 +45,7 @@ void *xmalloc (size_t size)
void *xrealloc (void *ptr, size_t size) void *xrealloc (void *ptr, size_t size)
{ {
void *res = realloc (ptr, size); void *res = realloc (ptr, size);
if (res == NULL) if (size && res == NULL)
{ {
fprintf (stderr, "Virtual memory exhausted.\n"); fprintf (stderr, "Virtual memory exhausted.\n");
exit (1); exit (1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment