[Python-checkins] cpython (3.5): Issue #25745: Fixed leaking a userptr in curses panel destructor.

serhiy.storchaka python-checkins at python.org
Sun May 8 17:14:47 EDT 2016


https://hg.python.org/cpython/rev/afed12943ddd
changeset:   101279:afed12943ddd
branch:      3.5
parent:      101276:3579cdaf56d9
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon May 09 00:11:59 2016 +0300
summary:
  Issue #25745: Fixed leaking a userptr in curses panel destructor.

files:
  Misc/NEWS               |  2 ++
  Modules/_curses_panel.c |  5 +++++
  2 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -116,6 +116,8 @@
 Library
 -------
 
+- Issue #25745: Fixed leaking a userptr in curses panel destructor.
+
 - Issue #26881: The modulefinder module now supports extended opcode arguments.
 
 - Issue #23815: Fixed crashes related to directly created instances of types in
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -220,6 +220,11 @@
 static void
 PyCursesPanel_Dealloc(PyCursesPanelObject *po)
 {
+    PyObject *obj = (PyObject *) panel_userptr(po->pan);
+    if (obj) {
+        (void)set_panel_userptr(po->pan, NULL);
+        Py_DECREF(obj);
+    }
     (void)del_panel(po->pan);
     if (po->wo != NULL) {
         Py_DECREF(po->wo);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list