summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2005-12-18 13:58:25 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2005-12-18 13:58:25 (GMT)
commit0149e3a0903be8d47d1d6da0fd9ff3767c517085 (patch)
treedb9f043c8b99ec35a642cd804f585a47f8f460a0 /Modules/_elementtree.c
parent7c460740ede2b14d5b4792e6c2bccc6d53cf0206 (diff)
downloadcpython-0149e3a0903be8d47d1d6da0fd9ff3767c517085.zip
cpython-0149e3a0903be8d47d1d6da0fd9ff3767c517085.tar.gz
cpython-0149e3a0903be8d47d1d6da0fd9ff3767c517085.tar.bz2
Fixed None reference leaks in TreeBuilder class (reported by Neal
Norwitz)
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c4
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)
);