Issue #15876: Fix a refleak in the curses module

The refleak occurred when assigning to window.encoding.
This commit is contained in:
Ross Lagerwall 2012-09-07 08:34:23 +02:00
parent 4e2514031a
commit 2dabaf63cf
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,8 @@ Core and Builtins
Library Library
------- -------
- Issue #15876: Fix a refleak in the curses module: window.encoding.
- Issue #15841: The readable(), writable() and seekable() methods of BytesIO - Issue #15841: The readable(), writable() and seekable() methods of BytesIO
and StringIO objects now raise ValueError when the object has been closed. and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura. Patch by Alessandro Moura.

View File

@ -1938,6 +1938,7 @@ PyCursesWindow_set_encoding(PyCursesWindowObject *self, PyObject *value)
if (ascii == NULL) if (ascii == NULL)
return -1; return -1;
encoding = strdup(PyBytes_AS_STRING(ascii)); encoding = strdup(PyBytes_AS_STRING(ascii));
Py_DECREF(ascii);
if (encoding == NULL) { if (encoding == NULL) {
PyErr_NoMemory(); PyErr_NoMemory();
return -1; return -1;