commit | 9c0408d9b68d8f65aad22ca0767f154d6b9f526c | [log] [tgz] |
---|---|---|
author | Xiang Zhang <angwerzx@126.com> | Wed Mar 22 14:32:52 2017 +0800 |
committer | GitHub <noreply@github.com> | Wed Mar 22 14:32:52 2017 +0800 |
tree | e9a6b641e5edeb4fb4bb04b85ad41de70c4b3811 | |
parent | e6a55dd8391651a7d3a97b6215e70e48e628d3d7 [diff] [blame] |
bpo-29876: fix DECREF for NULL value in subelement() (GH-760)
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 @@ } elem = element_new(tag, attrib); - Py_DECREF(attrib); + if (elem == NULL) + return NULL; if (element_add_subelement(parent, elem) < 0) { Py_DECREF(elem);