From e616b45c835b72034cd816e9d43e5c3a044f259f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 3 Aug 2011 20:43:08 +0200 Subject: [PATCH] =?UTF-8?q?Bugfix:=20realloc()=20with=20size=20=3D=3D=200?= =?UTF-8?q?=20works=20like=20free()=20and=20returns=20NULL,=20so=20don?= =?UTF-8?q?=E2=80=99t=20die()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; }