From: Ross Lagerwall Date: Fri, 7 Sep 2012 06:34:23 +0000 (+0200) Subject: Issue #15876: Fix a refleak in the curses module X-Git-Tag: v3.3.1rc1~818^2^2~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2dabaf63cf165dce61edbd51edfa5510348371bf;p=python Issue #15876: Fix a refleak in the curses module The refleak occurred when assigning to window.encoding. --- diff --git a/Misc/NEWS b/Misc/NEWS index 8046b7bf45..9babfd86a8 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,8 @@ Core and Builtins Library ------- +- Issue #15876: Fix a refleak in the curses module: window.encoding. + - Issue #15841: The readable(), writable() and seekable() methods of BytesIO and StringIO objects now raise ValueError when the object has been closed. Patch by Alessandro Moura. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 3f9ca1313d..4e1449bf69 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1938,6 +1938,7 @@ PyCursesWindow_set_encoding(PyCursesWindowObject *self, PyObject *value) if (ascii == NULL) return -1; encoding = strdup(PyBytes_AS_STRING(ascii)); + Py_DECREF(ascii); if (encoding == NULL) { PyErr_NoMemory(); return -1;