From 7614df0c0f0d0458f8f9c442cd557e6387b4e40d Mon Sep 17 00:00:00 2001 From: Jan Dubois Date: Thu, 11 Jun 1998 22:28:36 +0200 Subject: [PATCH] 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 --- perl.c | 5 +---- util.c | 9 +++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) 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( { -- 2.7.4