This is the mail archive of the cygwin-patches mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Fri, Apr 21, 2006 at 02:52:06PM -0400, Pierre A. Humblet wrote:
In particular GetEnvironmentStrings returns a big block of storage that should be free (which we can't do), and that is going to be lost on a fork, potentially leading to trouble.
Thus I have another implementation using GetEnvironmentValue and cmalloc. (with HEAP_1_MAX, so that it will be released on the next exec). I also take advantage of spawn_info, whose existence I had forgotten. Overall it's also simpler.
Here is another patch, sorry for not sending this earlier.
I don't see any reason to permanently allocate memory with cmalloc.
I think that using GetEnvironmentStrings is still the right choice here. You just have to make sure that it gets freed. I'm going to check in a cleanup of getearly which will move the rawenv variable to a static which will potentially be used by environ_init. Then environ_init will free it if it has been previously set.
But doesn't the program then have a pointer to memory that has been freed? That pointer can also be accessed after forks.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |