Issue #15893: Improve error handling in main() and Py_FrozenMain()

* handle _PyMem_RawStrdup() failure
* Py_FrozenMain() releases memory on error
* Py_FrozenMain() duplicates the old locale, as done in main()
This commit is contained in:
Victor Stinner 2013-07-27 02:39:09 +02:00
parent 739cf4e3e6
commit c588feeea9
2 changed files with 28 additions and 16 deletions

View file

@ -45,6 +45,11 @@ main(int argc, char **argv)
#endif
oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
if (!oldloc) {
fprintf(stderr, "out of memory\n");
return 1;
}
setlocale(LC_ALL, "");
for (i = 0; i < argc; i++) {
argv_copy[i] = _Py_char2wchar(argv[i], NULL);