Commit 26338d1c authored by Georg Brandl's avatar Georg Brandl

another instance of #804543: use strdup() when saving the result of...

another instance of #804543: use strdup() when saving the result of setlocale() because it could be overwritten by subsequent setlocale()s.
parent ec12e829
...@@ -37,7 +37,7 @@ main(int argc, char **argv) ...@@ -37,7 +37,7 @@ main(int argc, char **argv)
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
return 1; return 1;
} }
oldloc = setlocale(LC_ALL, NULL); oldloc = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
#ifdef HAVE_BROKEN_MBSTOWCS #ifdef HAVE_BROKEN_MBSTOWCS
...@@ -67,6 +67,7 @@ main(int argc, char **argv) ...@@ -67,6 +67,7 @@ main(int argc, char **argv)
} }
} }
setlocale(LC_ALL, oldloc); setlocale(LC_ALL, oldloc);
free(oldloc);
res = Py_Main(argc, argv_copy); res = Py_Main(argc, argv_copy);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
PyMem_Free(argv_copy2[i]); PyMem_Free(argv_copy2[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment