2.0b1 on Solaris

Ethan Galstad nagios at nagios.org
Sat Jan 15 02:46:03 CET 2005


On 14 Jan 2005 at 16:44, Andreas Ericsson wrote:

> Ethan Galstad wrote:
> > Mark Anderson submitted (un)setenv replacement code recently, but I
> > think it would be better to use the native (un)setenv() calls when
> > available and back off to putenv() when needed.  I'll make a CVS
> > commit shortly with this.  The putenv() call will leak memory, but
> > only in child processes, and that should get cleaned up by the OS
> > when they exit.
> > 
> 
> Even if ...
> 
> for(i=0; environ[i]; i++) free(environ[i]);
> environ = NULL;
> 
> ... ? It should be safe to free all of it and null it out at the end
> of execution, since symbols are already resolved.
> 
> I haven't researched or tested, but perhaps extern char **environ;
> isn't 
>   available on all too many systems.
> 
[snip]

That would probably work as well, although it may not be necessary.  
The OS should clean up all memory allocated to the process and its 
environment when it exits.  At least, I think it should.  I guess it 
will require some testing.


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt




More information about the Developers mailing list