summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorEdin Kadribasic <edink@php.net>2006-12-10 01:23:41 +0000
committerEdin Kadribasic <edink@php.net>2006-12-10 01:23:41 +0000
commit42e1c9a1e0abf96b0501f067e83fcd7505331b67 (patch)
tree9f2578e22fd3dd9bc54b57a5462ca8e0a7d0b6cd /ext/standard
parentd9f03aac3481c648f8720f55bcecfd38cc6262b1 (diff)
downloadphp-git-42e1c9a1e0abf96b0501f067e83fcd7505331b67.tar.gz
Fixed by #39751 by KevinJohnHoffman at gmail dot com
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index a61d7c7034..977f59cece 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3837,6 +3837,9 @@ static void php_putenv_destructor(putenv_entry *pe)
SetEnvironmentVariable(pe->key, "bugbug");
#endif
putenv(pe->previous_value);
+# if defined(PHP_WIN32)
+ efree(pe->previous_value);
+# endif
} else {
# if HAVE_UNSETENV
unsetenv(pe->key);
@@ -4430,7 +4433,12 @@ PHP_FUNCTION(putenv)
pe.previous_value = NULL;
for (env = environ; env != NULL && *env != NULL; env++) {
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
+#if defined(PHP_WIN32)
+ /* must copy previous value because MSVCRT's putenv can free the string without notice */
+ pe.previous_value = estrndup(*env, 1024);
+#else
pe.previous_value = *env;
+#endif
break;
}
}