summaryrefslogtreecommitdiffstats
path: root/Modules/python.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-07 21:30:24 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-07 21:30:24 (GMT)
commit49fc8ece8172162510890f42127d2aa4e13f878b (patch)
tree798c7555b232e40e607ec1b01cec87687515cf57 /Modules/python.c
parent6f8eeee7b9cae7e3f899c89baefe9acc575f2fb5 (diff)
downloadcpython-49fc8ece8172162510890f42127d2aa4e13f878b.zip
cpython-49fc8ece8172162510890f42127d2aa4e13f878b.tar.gz
cpython-49fc8ece8172162510890f42127d2aa4e13f878b.tar.bz2
Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the GIL is held or not.
Diffstat (limited to 'Modules/python.c')
-rw-r--r--Modules/python.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/python.c b/Modules/python.c
index aaa7fcf..0ad1130 100644
--- a/Modules/python.c
+++ b/Modules/python.c
@@ -43,12 +43,12 @@ main(int argc, char **argv)
fpsetmask(m & ~FP_X_OFL);
#endif
- oldloc = strdup(setlocale(LC_ALL, NULL));
+ oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "");
for (i = 0; i < argc; i++) {
argv_copy[i] = _Py_char2wchar(argv[i], NULL);
if (!argv_copy[i]) {
- free(oldloc);
+ PyMem_RawFree(oldloc);
fprintf(stderr, "Fatal Python error: "
"unable to decode the command line argument #%i\n",
i + 1);
@@ -59,7 +59,7 @@ main(int argc, char **argv)
argv_copy2[argc] = argv_copy[argc] = NULL;
setlocale(LC_ALL, oldloc);
- free(oldloc);
+ PyMem_RawFree(oldloc);
res = Py_Main(argc, argv_copy);
for (i = 0; i < argc; i++) {
PyMem_RawFree(argv_copy2[i]);