summaryrefslogtreecommitdiffstats
path: root/Modules/python.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-02-27 17:52:38 (GMT)
committerGeorg Brandl <georg@python.org>2009-02-27 17:52:38 (GMT)
commit26338d1cfd056b353f87697e418003d63ac1c42f (patch)
tree672ef34b7334d1f896b4cec2014f8ae611c0d575 /Modules/python.c
parentec12e8295242e2513fee1db3935036f6bbc6df34 (diff)
downloadcpython-26338d1cfd056b353f87697e418003d63ac1c42f.zip
cpython-26338d1cfd056b353f87697e418003d63ac1c42f.tar.gz
cpython-26338d1cfd056b353f87697e418003d63ac1c42f.tar.bz2
another instance of #804543: use strdup() when saving the result of setlocale() because it could be overwritten by subsequent setlocale()s.
Diffstat (limited to 'Modules/python.c')
-rw-r--r--Modules/python.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/python.c b/Modules/python.c
index 9e78889..f6da86f 100644
--- a/Modules/python.c
+++ b/Modules/python.c
@@ -37,7 +37,7 @@ main(int argc, char **argv)
fprintf(stderr, "out of memory\n");
return 1;
}
- oldloc = setlocale(LC_ALL, NULL);
+ oldloc = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "");
for (i = 0; i < argc; i++) {
#ifdef HAVE_BROKEN_MBSTOWCS
@@ -67,6 +67,7 @@ main(int argc, char **argv)
}
}
setlocale(LC_ALL, oldloc);
+ free(oldloc);
res = Py_Main(argc, argv_copy);
for (i = 0; i < argc; i++) {
PyMem_Free(argv_copy2[i]);