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
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-895816517-1109288758=:45516
Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-ID: <20050224183507.Q46189@thor.farley.org>

On Thu, 24 Feb 2005, Dag-Erling Sm=F8rgrav wrote:

> Se=E1n 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=E1n
--=20
sean-freebsd@farley.org
--0-895816517-1109288758=:45516--



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