summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-02-22 22:13:18 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-22 22:13:18 +0000
commit551a8b838dd0aec11f1a7553b070651ef7bd1a24 (patch)
treebc15756c9e48e49b75b250fc1835605fb8c2c111 /perl.c
parent1fd3532f9ed8ec7839f29d416bafc4721424c1d9 (diff)
downloadperl-551a8b838dd0aec11f1a7553b070651ef7bd1a24.tar.gz
If we have a duplicated environment free it
if PERL_DESTRUCT_LEVEL. p4raw-id: //depot/perl@8896
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index a2538fe5c6..f199e4656f 100644
--- a/perl.c
+++ b/perl.c
@@ -438,6 +438,20 @@ perl_destruct(pTHXx)
return;
}
+ /* jettison our possibly duplicated environment */
+
+#ifdef USE_ENVIRON_ARRAY
+ if (environ != PL_origenviron) {
+ I32 i;
+
+ for (i = 0; environ[i]; i++)
+ Safefree(environ[i]);
+ Safefree(environ);
+
+ environ = PL_origenviron;
+ }
+#endif
+
/* loosen bonds of global variables */
if(PL_rsfp) {