From 0149e3a0903be8d47d1d6da0fd9ff3767c517085 Mon Sep 17 00:00:00 2001 From: Fredrik Lundh Date: Sun, 18 Dec 2005 13:58:25 +0000 Subject: [PATCH] Fixed None reference leaks in TreeBuilder class (reported by Neal Norwitz) --- Modules/_elementtree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index af813bd54bd..6348f521f88 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) );