Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0149e3a

Browse files
author
Fredrik Lundh
committed
Fixed None reference leaks in TreeBuilder class (reported by Neal
Norwitz)
1 parent 7c46074 commit 0149e3a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/_elementtree.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,10 +1501,12 @@ treebuilder_handle_start(TreeBuilderObject* self, PyObject* tag,
15011501

15021502
if (self->data) {
15031503
if (self->this == self->last) {
1504+
Py_DECREF(self->last->text);
15041505
self->last->text = JOIN_SET(
15051506
self->data, PyList_CheckExact(self->data)
15061507
);
15071508
} else {
1509+
Py_DECREF(self->last->tail);
15081510
self->last->tail = JOIN_SET(
15091511
self->data, PyList_CheckExact(self->data)
15101512
);
@@ -1606,10 +1608,12 @@ treebuilder_handle_end(TreeBuilderObject* self, PyObject* tag)
16061608

16071609
if (self->data) {
16081610
if (self->this == self->last) {
1611+
Py_DECREF(self->last->text);
16091612
self->last->text = JOIN_SET(
16101613
self->data, PyList_CheckExact(self->data)
16111614
);
16121615
} else {
1616+
Py_DECREF(self->last->tail);
16131617
self->last->tail = JOIN_SET(
16141618
self->data, PyList_CheckExact(self->data)
16151619
);

0 commit comments

Comments
 (0)