From: Georg Brandl Date: Fri, 27 Feb 2009 17:54:11 +0000 (+0000) Subject: Merged revisions 70029 via svnmerge from X-Git-Tag: 3.0~353 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c1534cb64561aa47d7a107339ac91a1af76b018;p=thirdparty%2FPython%2Fcpython.git Merged revisions 70029 via svnmerge from svn+ssh://svn.python.org/python/branches/py3k ........ r70029 | georg.brandl | 2009-02-27 18:52:38 +0100 (Fr, 27 Feb 2009) | 1 line another instance of #804543: use strdup() when saving the result of setlocale() because it could be overwritten by subsequent setlocale()s. ........ --- diff --git a/Modules/python.c b/Modules/python.c index 9e7888999f49..f6da86f1d682 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]);