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!)
Previous text:
2003-10-17 16:51: Subject: Re: putenv/getenv
putenv(3) is a strange function that way; it's essentially impossible to write a pike wrapper for it without causing memory leaks. I guess that's why it doesn't exist already.
Bill, in your putenv glue I think you should note prominently in the doc that it will leak. You should also make a call to dmalloc_accept_leak with the strdup'ed string that leaks, so that dmalloc won't report them. Ideally _memory_usage should also return how much have leaked that way, so that users can check that.
/ Martin Stjernholm, Roxen IS