From: Antony Dovgal Date: Mon, 12 May 2008 08:46:49 +0000 (+0000) Subject: revert patch that causes invalid reads/crashes on Linux X-Git-Tag: RELEASE_2_0_0b1~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7ec33a1ef4b5f5c6b72924560f0134c3cc879da;p=php revert patch that causes invalid reads/crashes on Linux --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 7b29618b27..358e8e821e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3822,7 +3822,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); @@ -4386,8 +4388,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 */ - /* must copy previous value because putenv can free the string without notice */ +#if defined(PHP_WIN32) + /* must copy previous value because MSVCRT's putenv can free the string without notice */ pe.previous_value = estrdup(*env); +#else + pe.previous_value = *env; +#endif break; } }