]> granicus.if.org Git - python/commitdiff
Issue #15876: Fix a refleak in the curses module
authorRoss Lagerwall <rosslagerwall@gmail.com>
Fri, 7 Sep 2012 06:34:23 +0000 (08:34 +0200)
committerRoss Lagerwall <rosslagerwall@gmail.com>
Fri, 7 Sep 2012 06:34:23 +0000 (08:34 +0200)
The refleak occurred when assigning to window.encoding.

Misc/NEWS
Modules/_cursesmodule.c

index 8046b7bf458bde98817498aa3ada357d17ce23b2..9babfd86a89e82956a6a4a6224ff16db62123171 100644 (file)
--- 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.
index 3f9ca1313dac1aa46f100f0114e5e793ba3167ab..4e1449bf69f9c6c1170187ebe0964a9cdeb2d156 100644 (file)
@@ -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;