Don't call setvar() with the VTEXTFIXED flag. A copy is created by

setvar() and passed to setvareq(). When the VTEXTFIXED flag is set,
that copy is never freed, causing a memory leak.

PR:		31533
Submitted by:	maxim@macomnet.ru
This commit is contained in:
Tor Egge 2001-11-07 23:00:05 +00:00
parent 482a6000bb
commit f14c1c47f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86176

View File

@ -238,8 +238,8 @@ updatepwd(dir)
curdir = NULL;
if (getpwd() == NULL)
error("getcwd() failed: %s", strerror(errno));
setvar("PWD", curdir, VEXPORT | VTEXTFIXED);
setvar("OLDPWD", prevdir, VEXPORT | VTEXTFIXED);
setvar("PWD", curdir, VEXPORT);
setvar("OLDPWD", prevdir, VEXPORT);
INTON;
return;
}
@ -270,8 +270,8 @@ updatepwd(dir)
ckfree(prevdir);
prevdir = curdir;
curdir = savestr(stackblock());
setvar("PWD", curdir, VEXPORT | VTEXTFIXED);
setvar("OLDPWD", prevdir, VEXPORT | VTEXTFIXED);
setvar("PWD", curdir, VEXPORT);
setvar("OLDPWD", prevdir, VEXPORT);
INTON;
}