X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl.c;h=52301146c6cbb820985d278d07643de44af88f7d;hb=43bb546a01e54de6c96472cbb373abf202b991da;hp=7164d555eee9a444ff7b9f31676d1c7c5ecbfb76;hpb=9f4bd2225c152364d8589911c4c769edae165d9b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perl.c b/perl.c index 7164d55..5230114 100644 --- a/perl.c +++ b/perl.c @@ -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,'=')))