Date: Wed, 7 Nov 2001 00:20:01 -0800 (PST) From: Maxim Konovalov <maxim@macomnet.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/31533: /bin/sh memory leak (fwd) Message-ID: <200111070820.fA78K1X12566@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/31533; it has been noted by GNATS.
From: Maxim Konovalov <maxim@macomnet.ru>
To: freebsd-gnats-sumbit@freebsd.org
Cc: Bob Bishop <rb@gid.co.uk>
Subject: Re: bin/31533: /bin/sh memory leak (fwd)
Date: Wed, 7 Nov 2001 11:06:20 +0300 (MSK)
Just as follow up.
>From maxim@macomnet.ru Wed Nov 7 11:03:46 2001
Date: Mon, 5 Nov 2001 23:12:21 +0300 (MSK)
From: Maxim Konovalov <maxim@macomnet.ru>
To: Alfred Perlstein <bright@mu.org>
Cc: Bob Bishop <rb@gid.co.uk>, hackers@FreeBSD.ORG
Subject: Re: Committer please
Hello,
On Mon, 5 Nov 2001, Alfred Perlstein wrote:
> * Bob Bishop <rb@gid.co.uk> [011105 06:35] wrote:
> > Hi,
> >
> > Would some kind committer please have a look at bin/31533: /bin/sh memory
> > leak. There is a patch there which I believe is OK. Having a memory leak
> > loose in the shell seems like a Bad Idea to me. TIA
>
> Understandable, things like this could be applied more quickly if
> someone would take the time to explain what the delta does other
> than fix the problem. Meaning, what is VTEXTFIXED, and what does
> removing it change?
OK, mea culpa.
/usr/src/bin/sh/var.h:48
#define VTEXTFIXED 0x08 /* text is staticly allocated */
Afaiu it is used for internal variables names which are statically
allocated in /usr/src/bin/sh/var.c:102. VTEXTFIXED prevents them from
freing:
/usr/src/bin/sh/var.c:319
if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(vp->text);
PWD and OLDPWD variables are not statical ones and should be
reallocated every time when changed.
- -maxim
--
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111070820.fA78K1X12566>
