From: Fredrik Lundh Date: Sun, 18 Dec 2005 13:58:25 +0000 (+0000) Subject: Fixed None reference leaks in TreeBuilder class (reported by Neal X-Git-Tag: v2.5a0~986 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0149e3a0903be8d47d1d6da0fd9ff3767c517085;p=thirdparty%2FPython%2Fcpython.git Fixed None reference leaks in TreeBuilder class (reported by Neal Norwitz) --- diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index af813bd54bd0..6348f521f889 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1501,10 +1501,12 @@ treebuilder_handle_start(TreeBuilderObject* self, PyObject* tag, if (self->data) { if (self->this == self->last) { + Py_DECREF(self->last->text); self->last->text = JOIN_SET( self->data, PyList_CheckExact(self->data) ); } else { + Py_DECREF(self->last->tail); self->last->tail = JOIN_SET( self->data, PyList_CheckExact(self->data) ); @@ -1606,10 +1608,12 @@ treebuilder_handle_end(TreeBuilderObject* self, PyObject* tag) if (self->data) { if (self->this == self->last) { + Py_DECREF(self->last->text); self->last->text = JOIN_SET( self->data, PyList_CheckExact(self->data) ); } else { + Py_DECREF(self->last->tail); self->last->tail = JOIN_SET( self->data, PyList_CheckExact(self->data) );