diff options
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r-- | Modules/_elementtree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 7e36ea384b1..871aa186c25 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -327,8 +327,10 @@ element_new(PyObject* tag, PyObject* attrib) if (attrib != Py_None) { - if (element_new_extra(self, attrib) < 0) + if (element_new_extra(self, attrib) < 0) { + PyObject_Del(self); return NULL; + } self->extra->length = 0; self->extra->allocated = STATIC_CHILDREN; |