From: Zebediah Figura zfigura@codeweavers.com
env_set() modifies both environments in either case, and expects the variables to have separate allocations already.
Fixes: bdb624fffb1c1acc1feb2baec396d9b805cb0ce9 --- dlls/msvcrt/environ.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/environ.c b/dlls/msvcrt/environ.c index 9e358d971f9..0a0bb5ce058 100644 --- a/dlls/msvcrt/environ.c +++ b/dlls/msvcrt/environ.c @@ -265,7 +265,8 @@ static int putenv_helper(const char *name, const char *val, const char *eq) int r;
_lock(_ENV_LOCK); - r = env_init(FALSE, TRUE); + if (!(r = env_init(FALSE, TRUE))) + r = env_init(TRUE, TRUE); _unlock(_ENV_LOCK); if (r) return -1;
@@ -320,7 +321,8 @@ static int wputenv_helper(const wchar_t *name, const wchar_t *val, const wchar_t int r;
_lock(_ENV_LOCK); - r = env_init(TRUE, TRUE); + if (!(r = env_init(FALSE, TRUE))) + r = env_init(TRUE, TRUE); _unlock(_ENV_LOCK); if (r) return -1;