From: Björn Jacke Date: Tue, 9 Nov 2010 20:33:46 +0000 (+0100) Subject: Fix calloc success check X-Git-Tag: v3.1.2~11 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce5d7154d2bed2832375cfd6dde4400fb1a1404a;p=thirdparty%2Fccache.git Fix calloc success check On Tru64 I had issues with this: If the number of elements or the size is 0 then you may get a NULL pointer back, which is not a sign of an error. --- diff --git a/util.c b/util.c index 73c192018..96fe1f7b1 100644 --- a/util.c +++ b/util.c @@ -555,7 +555,7 @@ x_calloc(size_t nmemb, size_t size) { void *ret; ret = calloc(nmemb, size); - if (!ret) { + if (!ret && nmemb && size) { fatal("x_calloc: Could not allocate %lu bytes", (unsigned long)size); } return ret;