]> granicus.if.org Git - python/commitdiff
Fixed None reference leaks in TreeBuilder class (reported by Neal
authorFredrik Lundh <fredrik@pythonware.com>
Sun, 18 Dec 2005 13:58:25 +0000 (13:58 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Sun, 18 Dec 2005 13:58:25 +0000 (13:58 +0000)
Norwitz)

Modules/_elementtree.c

index af813bd54bd0b3a54fa0dbee711aa7ffd21e6771..6348f521f889c05f3ce843b5ee3becc188d6122a 100644 (file)
@@ -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)
                 );