diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-05-02 07:54:51 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-05-02 07:54:51 +0000 |
commit | 9f4bd2225c152364d8589911c4c769edae165d9b (patch) | |
tree | 932744a8029e74125b8b27debc9855b07a16f046 /perlio.c | |
parent | 484370fa5498d4af5d0f5c36769063bfd9f326dc (diff) | |
download | perl-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.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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; + } } |