summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-05-02 07:54:51 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-05-02 07:54:51 +0000
commit9f4bd2225c152364d8589911c4c769edae165d9b (patch)
tree932744a8029e74125b8b27debc9855b07a16f046 /perl.c
parent484370fa5498d4af5d0f5c36769063bfd9f326dc (diff)
downloadperl-9f4bd2225c152364d8589911c4c769edae165d9b.tar.gz
Fix the "PerlIO require leak". Snag was that clean_objs
autoloaded DESTROY (needing IO) after known layers had been freed. Postpone layer list free to PerlIO_cleanup, rather than PerlIO_destruct. Tweak sequence in perl_destruct so that sv_undef is immortal till layer list is done with it. p4raw-id: //depot/perlio@16335
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/perl.c b/perl.c
index 7b6eb62b33..7164d555ee 100644
--- a/perl.c
+++ b/perl.c
@@ -431,7 +431,7 @@ perl_destruct(pTHXx)
FREETMPS;
/* Need to flush since END blocks can produce output */
- PerlIO_flush((PerlIO*)NULL);
+ PerlIO_flush((PerlIO*)NULL);
if (CALL_FPTR(PL_threadhook)(aTHX)) {
/* Threads hook has vetoed further cleanup */
@@ -825,9 +825,6 @@ perl_destruct(pTHXx)
SvANY(&PL_sv_no) = NULL;
SvFLAGS(&PL_sv_no) = 0;
- SvREFCNT(&PL_sv_undef) = 0;
- SvREADONLY_off(&PL_sv_undef);
-
{
int i;
for (i=0; i<=2; i++) {
@@ -846,6 +843,13 @@ perl_destruct(pTHXx)
PerlIO_cleanup(aTHX);
#endif
+ /* sv_undef needs to stay immortal until after PerlIO_cleanup
+ as currently layers use it rather than Nullsv as a marker
+ for no arg - and will try and SvREFCNT_dec it.
+ */
+ SvREFCNT(&PL_sv_undef) = 0;
+ SvREADONLY_off(&PL_sv_undef);
+
Safefree(PL_origfilename);
Safefree(PL_reg_start_tmp);
if (PL_reg_curpm)