Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Feb 2005 19:39:42 -0600 (CST)
From:      =?ISO-8859-1?Q?Se=E1n_C=2E_Farley?= <sean-freebsd@farley.org>
To:        =?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?= <des@des.no>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: setenv/unsetenv's known memory leak
Message-ID:  <20050224174015.D45516@thor.farley.org>
In-Reply-To: <86ekf65ssx.fsf@xps.des.no>
References:  <20050222173013.B26342@thor.farley.org> <863bvnmyrt.fsf@xps.des.no> <20050223140733.T35108@thor.farley.org> <86ekf65ssx.fsf@xps.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 24 Feb 2005, Dag-Erling Smørgrav wrote:

> Seán C. Farley <sean-freebsd@farley.org> writes:
>> How does this version look?
>
> Needlessly complicated.  I'd just copy the entire environment into
> malloc()ed space the first time setenv() or putenv() is called.

I like complicated.  :)  I have written a new version that makes copies
of all variables within the environment upon the first run of setenv().

Here are the two versions I have written to stop the memory leak.
Old (complex):  http://www.farley.org/freebsd/tmp/setenv-1.tar.bz2
New (simple):  http://www.farley.org/freebsd/tmp/setenv-2.tar.bz2

Seán
-- 
sean-freebsd@farley.org

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050224174015.D45516>