]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #25745: Fixed leaking a userptr in curses panel destructor.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 8 May 2016 21:11:59 +0000 (00:11 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 8 May 2016 21:11:59 +0000 (00:11 +0300)
Misc/NEWS
Modules/_curses_panel.c

index a67f3e9daec300e9267ef6788112e2a760ccb640..0f55e760797ec23b8fd5d780fd22e061d0954b3d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,7 +77,7 @@ Core and Builtins
 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.
index d61281ed06bf083a3319785cef718693f8b3a997..bc894479dee1f8ce1188498fc776bffbfefa2d49 100644 (file)
@@ -191,6 +191,11 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
 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);