summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 21c2cac..ab6ed58 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -235,7 +235,7 @@ Py_Initialize(void)
initialized by other means. Also set the encoding of
stdin and stdout if these are terminals. */
- saved_locale = setlocale(LC_CTYPE, NULL);
+ saved_locale = strdup(setlocale(LC_CTYPE, NULL));
setlocale(LC_CTYPE, "");
codeset = nl_langinfo(CODESET);
if (codeset && *codeset) {
@@ -250,6 +250,7 @@ Py_Initialize(void)
} else
codeset = NULL;
setlocale(LC_CTYPE, saved_locale);
+ free(saved_locale);
if (codeset) {
sys_stream = PySys_GetObject("stdin");