diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2002-05-02 15:44:48 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2002-05-02 15:44:48 +0000 |
commit | 4efc5df63c21e7be3ddafb142377fe2511926c04 (patch) | |
tree | ab27aa859fec026d0dcbf95d8dd5ab4a03f08f06 /perl.c | |
parent | 2fc614e01c5e692def72089696c0a1da4f6f3833 (diff) | |
download | perl-4efc5df63c21e7be3ddafb142377fe2511926c04.tar.gz |
manual integrate of change#16332 from maint-5.6 branch
p4raw-link: @16332 on //depot/maint-5.6/perl: 9bf7742e23b67e3d7c671615795c570c51951513
p4raw-id: //depot/perl@16348
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -498,7 +498,13 @@ perl_destruct(pTHXx) * so we certainly shouldn't free it here */ #if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV) - if (environ != PL_origenviron) { + if (environ != PL_origenviron +#ifdef USE_ITHREADS + /* only main thread can free environ[0] contents */ + && PL_curinterp == aTHX +#endif + ) + { I32 i; for (i = 0; environ[i]; i++) @@ -3576,8 +3582,14 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register */ if (!env) env = environ; - if (env != environ) + if (env != environ +# ifdef USE_ITHREADS + && PL_curinterp == aTHX +# endif + ) + { environ[0] = Nullch; + } if (env) for (; *env; env++) { if (!(s = strchr(*env,'='))) |