diff options
-rw-r--r-- | Modules/_elementtree.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index af813bd..6348f52 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) ); |