Sender: nate AT cartsys DOT com Message-ID: <37BDD1B6.625F6DE9@cartsys.com> Date: Fri, 20 Aug 1999 15:07:50 -0700 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.12pre4 i586) MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: [RESEND] Re: Possible Bug in realloc() References: <7pa8ti$73k AT newsstand DOT cit DOT cornell DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Sorry to resend, but I think this is a fairly important bug and I wanted to make sure the patch got in. This fixes a reported bug where a realloc() when memory was exhausted would dereference NULL and otherwise misbehave. --- src/libc/ansi/stdlib/malloc.c Thu Jun 3 14:13:20 1999 +++ src/libc/ansi/stdlib/malloc.c.new Mon Aug 16 23:58:04 1999 @@ -348,6 +348,8 @@ } newptr = (char *)malloc(size); + if (!newptr) + return NULL; #if DEBUG printf("realloc %u %u/%08x %08x->%08, %u\n", size, b->size & ~1, b, ptr, newptr, copysize); -- Nate Eldredge nate AT cartsys DOT com