Using environment variables without leaking memory?

Rob Landley rob at landley.net
Tue Oct 31 21:46:51 UTC 2006


On Tuesday 31 October 2006 4:12 pm, Erik Andersen wrote:
> On Tue Oct 31, 2006 at 01:09:26PM -0500, Rob Landley wrote:
> > I wonder if Erik's been following this conversation...
> 
> of course

So would you prefer a patch to uClibc that makes unsetenv() free environment 
variables created by setenv() (but not those added by putenv), or would you 
prefer a patch that leaves the current unsetenv() behavior alone and adds a 
new freeenv() which frees variables added by either setenv() or putenv() (but 
not those inherited from exec)?

The first is allowed by SUSv3 (possibly even suggested by it) but could easily 
break existing programs.  The second ignores the standard entirely but 
definitely wouldn't break any existing programs.

Right now, environment variables just leak, and there's no obvious way to use 
the library functions and _not_ to leak them.

>  -Erik

Rob
-- 
"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery



More information about the uClibc mailing list