From: Serhiy Storchaka Date: Sun, 8 May 2016 21:11:59 +0000 (+0300) Subject: Issue #25745: Fixed leaking a userptr in curses panel destructor. X-Git-Tag: v3.6.0a1~51^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df40b623904c78847bbe24b9604a5b0522eafdb9;p=thirdparty%2FPython%2Fcpython.git Issue #25745: Fixed leaking a userptr in curses panel destructor. --- diff --git a/Misc/NEWS b/Misc/NEWS index f9bb8efbe083..d41910a92f38 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -116,6 +116,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 c77e614724e0..228f4971ac37 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);