From: Michael Stapelberg Date: Wed, 3 Aug 2011 18:43:08 +0000 (+0200) Subject: Bugfix: realloc() with size == 0 works like free() and returns NULL, so don’t die() X-Git-Tag: 4.0.2~62^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e616b45c835b72034cd816e9d43e5c3a044f259f;p=i3%2Fi3 Bugfix: realloc() with size == 0 works like free() and returns NULL, so don’t die() --- diff --git a/src/util.c b/src/util.c index 1ad43d3f..fc0a5ceb 100644 --- a/src/util.c +++ b/src/util.c @@ -77,7 +77,8 @@ void *scalloc(size_t size) { void *srealloc(void *ptr, size_t size) { void *result = realloc(ptr, size); - exit_if_null(result, "Error: out memory (realloc(%zd))\n", size); + if (result == NULL && size > 0) + die("Error: out memory (realloc(%zd))\n", size); return result; }