Commit 9c0408d9 authored by Xiang Zhang's avatar Xiang Zhang Committed by GitHub

bpo-29876: fix DECREF for NULL value in subelement() (GH-760)

parent e6a55dd8
...@@ -524,8 +524,9 @@ subelement(PyObject* self, PyObject* args, PyObject* kw) ...@@ -524,8 +524,9 @@ subelement(PyObject* self, PyObject* args, PyObject* kw)
} }
elem = element_new(tag, attrib); elem = element_new(tag, attrib);
Py_DECREF(attrib); Py_DECREF(attrib);
if (elem == NULL)
return NULL;
if (element_add_subelement(parent, elem) < 0) { if (element_add_subelement(parent, elem) < 0) {
Py_DECREF(elem); Py_DECREF(elem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment