From 22d8942b8d8d06e3d869cdad24598f9c7d8a095f Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 9 May 2016 00:11:59 +0300 Subject: [PATCH] Issue #25745: Fixed leaking a userptr in curses panel destructor. --- Misc/NEWS | 2 +- Modules/_curses_panel.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index a67f3e9dae..0f55e76079 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 d61281ed06..bc894479de 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); -- 2.50.1