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

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


https://hg.python.org/cpython/rev/1662b41e1663
changeset:   101280:1662b41e1663
branch:      2.7
parent:      101278:f06baed1bb0c
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, 6 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,7 +77,7 @@
 Library
 -------
 
-- Issue #26881: modulefinder now works with bytecode with extended args.
+- Issue #25745: Fixed leaking a userptr in curses panel destructor.
 
 - Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
   Patch by Georg Brandl.
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -191,6 +191,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