NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/43899: setenv(3)/unsetenv(3) memory leak
The following reply was made to PR lib/43899; it has been noted by GNATS.
From: Nicolas Joly <njoly%pasteur.fr@localhost>
To: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/43899: setenv(3)/unsetenv(3) memory leak
Date: Mon, 27 Sep 2010 18:24:07 +0200
On Sat, Sep 25, 2010 at 05:16:33PM +0900, ITOH Yasufumi wrote:
> In article <20100923131001.5C93F63B995%www.NetBSD.org@localhost>
> njoly%pasteur.fr@localhost writes:
>
> > >Description:
> > I just noticed that unsetenv(3) does not seems to reclaim memory that was
> > allocated by setenv(3) for a single variable.
>
> setenv(3) leaks memory by its nature. It's a spec.
True. While i can understand that setenv(3) only in a loop do/can leak
memory, but if associated with unsetenv(3) in the same loop it should
not.
> The problem is that our implementation of putenv(3) leaks memory.
> The standard says we can use putenv(3) without memory leaks.
> http://www.opengroup.org/onlinepubs/9699919799/functions/putenv.html
Looks like it should try to unset the variable if it exists before
setting it again.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
Home |
Main Index |
Thread Index |
Old Index