On Thu, Sep 30, 2010 at 12:41:34PM +0000, Matthias Scheler wrote: > Module Name: src > Committed By: tron > Date: Thu Sep 30 12:41:33 UTC 2010 > > Modified Files: > src/lib/libc/stdlib: setenv.c unsetenv.c > > Log Message: > Be slightly more careful about freeing memory allocated for environment > variables: only free memory if the current value points to the same > memory area as the allocated block. This will prevent crashes if an > application changes the order of the environment array. > > Unfortunately this is still not enough to stop zsh 4.2.* from crashing. > zsh 4.3.* works fine before and after this change.
Thanks Matthias, One possibility could be to not free memory at all in setenv, but only with unsetenv. IMHO, it's a programmer error to call setenv more than once on the same variable without a corresponding unsetenv in between (just like malloc()/free() behaviour). Otherwise, if i understand things correctly, it's more putenv that shoud work that way. -- Nicolas Joly Biological Software and Databanks. Institut Pasteur, Paris.