summaryrefslogtreecommitdiff
path: root/perlio.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 /perlio.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 'perlio.c')
-rw-r--r--perlio.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/perlio.c b/perlio.c
index ac355274e1..e80c1f0fbf 100644
--- a/perlio.c
+++ b/perlio.c
@@ -601,10 +601,6 @@ PerlIO_destruct(pTHX)
f++;
}
}
- PerlIO_list_free(aTHX_ PL_known_layers);
- PL_known_layers = NULL;
- PerlIO_list_free(aTHX_ PL_def_layerlist);
- PL_def_layerlist = NULL;
}
void
@@ -2071,7 +2067,9 @@ PerlIO_cleanup(pTHX)
{
int i;
#ifdef USE_ITHREADS
- PerlIO_debug("Cleanup %p\n",aTHX);
+ PerlIO_debug("Cleanup layers for %p\n",aTHX);
+#else
+ PerlIO_debug("Cleanup layers\n");
#endif
/* Raise STDIN..STDERR refcount so we don't close them */
for (i=0; i < 3; i++)
@@ -2080,6 +2078,15 @@ PerlIO_cleanup(pTHX)
/* Restore STDIN..STDERR refcount */
for (i=0; i < 3; i++)
PerlIOUnix_refcnt_dec(i);
+
+ if (PL_known_layers) {
+ PerlIO_list_free(aTHX_ PL_known_layers);
+ PL_known_layers = NULL;
+ }
+ if(PL_def_layerlist) {
+ PerlIO_list_free(aTHX_ PL_def_layerlist);
+ PL_def_layerlist = NULL;
+ }
}