summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-05-08 21:14:22 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-05-08 21:14:22 (GMT)
commit6a8af9ab36aaa18308f5f742a81035d7d9e41b5e (patch)
tree74c0752bb149252573bc2d87b76900615bab8d84
parent3e99fdeed5cff4eda913ea0082cdb94e59ce629d (diff)
parentdf40b623904c78847bbe24b9604a5b0522eafdb9 (diff)
downloadcpython-6a8af9ab36aaa18308f5f742a81035d7d9e41b5e.zip
cpython-6a8af9ab36aaa18308f5f742a81035d7d9e41b5e.tar.gz
cpython-6a8af9ab36aaa18308f5f742a81035d7d9e41b5e.tar.bz2
Issue #25745: Fixed leaking a userptr in curses panel destructor.
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_curses_panel.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index c58bac7..55963b0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -268,6 +268,8 @@ Core and Builtins
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
index bd31326..18ef335 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -220,6 +220,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);