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);
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;
}
}