[Python-checkins] cpython: Issue #15876: Fix a refleak in the curses module

ross.lagerwall python-checkins at python.org
Fri Sep 7 08:38:27 CEST 2012


http://hg.python.org/cpython/rev/c82e3a6553fc
changeset: 78872:c82e3a6553fc
parent: 78870:ffcb7f5f2e48
user: Ross Lagerwall <rosslagerwall at gmail.com>
date: Fri Sep 07 08:34:23 2012 +0200
summary:
 Issue #15876: Fix a refleak in the curses module
The refleak occurred when assigning to window.encoding.
files:
 Misc/NEWS | 2 ++
 Modules/_cursesmodule.c | 1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -26,6 +26,8 @@
 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
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1938,6 +1938,7 @@
 if (ascii == NULL)
 return -1;
 encoding = strdup(PyBytes_AS_STRING(ascii));
+ Py_DECREF(ascii);
 if (encoding == NULL) {
 PyErr_NoMemory();
 return -1;
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /