summaryrefslogtreecommitdiff
path: root/Modules/_cursesmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-07 23:30:24 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-07-07 23:30:24 +0200
commit49fc8ece8172162510890f42127d2aa4e13f878b (patch)
tree798c7555b232e40e607ec1b01cec87687515cf57 /Modules/_cursesmodule.c
parent6f8eeee7b9cae7e3f899c89baefe9acc575f2fb5 (diff)
downloadcpython-git-49fc8ece8172162510890f42127d2aa4e13f878b.tar.gz
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/_cursesmodule.c')
-rw-r--r--Modules/_cursesmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index fbe18f6e06..5d1489852d 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -529,7 +529,7 @@ PyCursesWindow_New(WINDOW *win, const char *encoding)
wo = PyObject_NEW(PyCursesWindowObject, &PyCursesWindow_Type);
if (wo == NULL) return NULL;
wo->win = win;
- wo->encoding = strdup(encoding);
+ wo->encoding = _PyMem_Strdup(encoding);
if (wo->encoding == NULL) {
Py_DECREF(wo);
PyErr_NoMemory();
@@ -543,7 +543,7 @@ PyCursesWindow_Dealloc(PyCursesWindowObject *wo)
{
if (wo->win != stdscr) delwin(wo->win);
if (wo->encoding != NULL)
- free(wo->encoding);
+ PyMem_Free(wo->encoding);
PyObject_DEL(wo);
}
@@ -1938,13 +1938,13 @@ PyCursesWindow_set_encoding(PyCursesWindowObject *self, PyObject *value)
ascii = PyUnicode_AsASCIIString(value);
if (ascii == NULL)
return -1;
- encoding = strdup(PyBytes_AS_STRING(ascii));
+ encoding = _PyMem_Strdup(PyBytes_AS_STRING(ascii));
Py_DECREF(ascii);
if (encoding == NULL) {
PyErr_NoMemory();
return -1;
}
- free(self->encoding);
+ PyMem_Free(self->encoding);
self->encoding = encoding;
return 0;
}