diff options
author | Xiang Zhang <angwerzx@126.com> | 2017-03-22 06:32:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 06:32:52 (GMT) |
commit | 9c0408d9b68d8f65aad22ca0767f154d6b9f526c (patch) | |
tree | e9a6b641e5edeb4fb4bb04b85ad41de70c4b3811 | |
parent | e6a55dd8391651a7d3a97b6215e70e48e628d3d7 (diff) | |
download | cpython-9c0408d9b68d8f65aad22ca0767f154d6b9f526c.zip cpython-9c0408d9b68d8f65aad22ca0767f154d6b9f526c.tar.gz cpython-9c0408d9b68d8f65aad22ca0767f154d6b9f526c.tar.bz2 |
bpo-29876: fix DECREF for NULL value in subelement() (GH-760)
-rw-r--r-- | Modules/_elementtree.c | 3 |
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); |