From: Brian Wellington Date: Tue, 22 Jan 2002 15:40:24 +0000 (+0000) Subject: 1189. [bug] On some systems, malloc(0) returns NULL, which X-Git-Tag: v9.0.1^2~8621 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=fca9cc33ad4299e58e53aa5273d805477267e27a;p=thirdparty%2Fbind9.git 1189. [bug] On some systems, malloc(0) returns NULL, which could cause the caller to report an out of memory error. [RT #2398] --- diff --git a/CHANGES b/CHANGES index a89ea5f16b2..6797b52f246 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1189. [bug] On some systems, malloc(0) returns NULL, which + could cause the caller to report an out of memory + error. [RT #2398] + 1188. [bug] Dynamic updates of a signed zone would fail if some of the zone private keys were unavailable. diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 2d7c650f90a..cff7ec6218f 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mem.c,v 1.109 2001/12/05 19:13:26 bwelling Exp $ */ +/* $Id: mem.c,v 1.110 2002/01/22 15:40:24 bwelling Exp $ */ #include @@ -680,6 +680,8 @@ mem_putstats(isc_mem_t *ctx, void *ptr, size_t size) { static void * default_memalloc(void *arg, size_t size) { UNUSED(arg); + if (size == 0) + size = 1; return (malloc(size)); }