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: v2.7.12rc1~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22d8942b8d8d06e3d869cdad24598f9c7d8a095f;p=thirdparty%2FPython%2Fcpython.git Issue #25745: Fixed leaking a userptr in curses panel destructor. --- diff --git a/Misc/NEWS b/Misc/NEWS index a67f3e9daec3..0f55e760797e 100644 --- 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. diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index d61281ed06bf..bc894479dee1 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -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);