setenv/unsetenv's known memory leak
Seán C. Farley
sean-freebsd at farley.org
Fri Feb 25 01:39:41 GMT 2005
On Thu, 24 Feb 2005, Dag-Erling Smørgrav wrote:
> Seán C. Farley <sean-freebsd at 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 at farley.org
More information about the freebsd-hackers
mailing list