]> granicus.if.org Git - python/commitdiff
another instance of #804543: use strdup() when saving the result of setlocale() becau...
authorGeorg Brandl <georg@python.org>
Fri, 27 Feb 2009 17:52:38 +0000 (17:52 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 27 Feb 2009 17:52:38 +0000 (17:52 +0000)
Modules/python.c

index 9e7888999f491df4266dce9824a085bba18cc30c..f6da86f1d682c32b6b24279f4e7ab3b87ef4b6c4 100644 (file)
@@ -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]);