Skip to content

Commit 9c0408d

Browse files
authored
bpo-29876: fix DECREF for NULL value in subelement() (GH-760)
1 parent e6a55dd commit 9c0408d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/_elementtree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,9 @@ subelement(PyObject* self, PyObject* args, PyObject* kw)
524524
}
525525

526526
elem = element_new(tag, attrib);
527-
528527
Py_DECREF(attrib);
528+
if (elem == NULL)
529+
return NULL;
529530

530531
if (element_add_subelement(parent, elem) < 0) {
531532
Py_DECREF(elem);

0 commit comments

Comments
 (0)