From: Björn Jacke Date: Tue, 9 Nov 2010 20:30:16 +0000 (+0100) Subject: Fix malloc success check X-Git-Tag: v3.1.2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e0299c1c080f70f32420b28ec18070d2eb782df;p=thirdparty%2Fccache.git Fix malloc success check On AIX and Tru64 I had issues with this: If you allocate 0 byte 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 ae1600698..73c192018 100644 --- a/util.c +++ b/util.c @@ -543,7 +543,7 @@ x_malloc(size_t size) { void *ret; ret = malloc(size); - if (!ret) { + if (!ret && size) { fatal("x_malloc: Could not allocate %lu bytes", (unsigned long)size); } return ret;