summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 7a0aeda..94dc5b7 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -524,8 +524,9 @@ subelement(PyObject* self, PyObject* args, PyObject* kw)
}
elem = element_new(tag, attrib);
-
Py_DECREF(attrib);
+ if (elem == NULL)
+ return NULL;
if (element_add_subelement(parent, elem) < 0) {
Py_DECREF(elem);