summaryrefslogtreecommitdiffstats
path: root/Modules/_curses_panel.c
diff options
context:
space:
mode:
authorAndrew Kuchling <amk@amk.ca>2013-06-15 18:04:04 (GMT)
committerAndrew Kuchling <amk@amk.ca>2013-06-15 18:04:04 (GMT)
commit53e5ea7951b674ed223ae8dd3bb2da595d685ec5 (patch)
treec85508389860c9d6450e142dab8d60d336835583 /Modules/_curses_panel.c
parent27bbfdbc4c85011b2bd7f21d3fe3b5e8c2d8b725 (diff)
downloadcpython-53e5ea7951b674ed223ae8dd3bb2da595d685ec5.zip
cpython-53e5ea7951b674ed223ae8dd3bb2da595d685ec5.tar.gz
cpython-53e5ea7951b674ed223ae8dd3bb2da595d685ec5.tar.bz2
#18113: Objects associated to a curses.panel object with set_userptr() were leaked.
Reported by Atsuo Ishimoto.
Diffstat (limited to 'Modules/_curses_panel.c')
-rw-r--r--Modules/_curses_panel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 1c7d084..c11f3d8 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -322,6 +322,10 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
static PyObject *
PyCursesPanel_set_panel_userptr(PyCursesPanelObject *self, PyObject *obj)
{
+ PyObject *oldobj;
+ PyCursesInitialised;
+ oldobj = (PyObject *) panel_userptr(self->pan);
+ Py_XDECREF(oldobj);
Py_INCREF(obj);
return PyCursesCheckERR(set_panel_userptr(self->pan, (void*)obj),
"set_panel_userptr");