Subject: Re: please review: unsetenv memory leak fix
To: Masaru OKI <>
From: Nathan J. Williams <>
List: tech-userlevel
Date: 06/27/2003 13:31:10
Masaru OKI <> writes:

> unsetenv(3) doesn't call free(3) with environment variable string.
> following diff is fixed the problem.
> If it is looks good, I'll commit it later.

This has the possiblity of overwriting (or permitting the overwriting
of) a string returned by getenv(). This is permitted by POSIX, but we
haven't documented it in the past. We need to determine if this is an
OK change to make based on past documentation, and if it is, the
documentation of getenv() also needs to be updated to mention this.

(I note, looking into this, that we don't mention that setenv() can
also change a string returned by getenv(), although not in a terribly
useful way).

        - Nathan