From: Jan Dubois Date: Thu, 11 Jun 1998 20:28:36 +0000 (+0200) Subject: added patch, undo earlier workaround X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7614df0c0f0d0458f8f9c442cd557e6387b4e40d;p=p5sagit%2Fp5-mst-13.2.git added patch, undo earlier workaround Subject: Re: Why does saferealloc(NULL,size) croak? [PATCH] against _66 Message-ID: <35831f69.4975644@smtp1.ibm.net> p4raw-id: //depot/perl@1125 --- diff --git a/perl.c b/perl.c index f436f44..7b76edf 100644 --- a/perl.c +++ b/perl.c @@ -604,10 +604,7 @@ CPerlObj::perl_atexit(void (*fn) (CPerlObj*,void *), void *ptr) perl_atexit(void (*fn) (void *), void *ptr) #endif { - if(exitlist) - Renew(exitlist, exitlistlen+1, PerlExitListEntry); - else - New(999, exitlist, 1, PerlExitListEntry); + Renew(exitlist, exitlistlen+1, PerlExitListEntry); exitlist[exitlistlen].fn = fn; exitlist[exitlistlen].ptr = ptr; ++exitlistlen; diff --git a/util.c b/util.c index 7479e47..294a68e 100644 --- a/util.c +++ b/util.c @@ -122,13 +122,18 @@ saferealloc(Malloc_t where,MEM_SIZE size) my_exit(1); } #endif /* HAS_64K_LIMIT */ + if (!size) { + safefree(where); + return NULL; + } + if (!where) - croak("Null realloc"); + return safemalloc(size); #ifdef DEBUGGING if ((long)size < 0) croak("panic: realloc"); #endif - ptr = PerlMem_realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ + ptr = PerlMem_realloc(where,size); #if !(defined(I286) || defined(atarist)) DEBUG_m( {