In env_destroy(), it is a bad idea to env_swap(self, 0) to switch

back to the original environ unconditionally.  The setting of the
variable to save the previous environ is conditional; it happens when
ENV.e_committed is set.  Therefore, don't try to swap the env back
unless the previous env has been initialized.

PR:		bin/22670
Submitted by:	Takanori Saneto <sanewo@ba2.so-net.ne.jp>
This commit is contained in:
green 2000-11-25 02:00:35 +00:00
parent de5ab7abc1
commit 163406c6e5
2 changed files with 4 additions and 0 deletions

View File

@ -176,6 +176,8 @@ env_destroy(ENV *self)
{
struct env_entry *p;
if (self->e_committed)
env_swap(self, 0);
env_swap(self, 0);
SLIST_FOREACH(p, &self->e_head, ee_entries) {
free(p->ee_env);

View File

@ -176,6 +176,8 @@ env_destroy(ENV *self)
{
struct env_entry *p;
if (self->e_committed)
env_swap(self, 0);
env_swap(self, 0);
SLIST_FOREACH(p, &self->e_head, ee_entries) {
free(p->ee_env);