That doesn't work if there is other C code that use putenv(3) directly. But it would still help bringing down the leaking quite a bit.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-17 16:53: Subject: Re: putenv/getenv
You could track the allocated strings and free them if the same environment variable is set to something else. Then the strings are never actually leaked.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)