mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
another instance of #804543: use strdup() when saving the result of setlocale() because it could be overwritten by subsequent setlocale()s.
This commit is contained in:
parent
ec12e82952
commit
26338d1cfd
1 changed files with 2 additions and 1 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue