summaryrefslogtreecommitdiff
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-12-10 23:05:13 -0800
committerGitHub <noreply@github.com>2018-12-10 23:05:13 -0800
commit62674f3a36ec55f86a5f20ee028a37fbd549bd6c (patch)
treee0e54395611c4a6eca057ea673c2d515fe45cd3b /Modules/_elementtree.c
parent3b9a0186c44d0c3e477c38fdc00203ec99aec912 (diff)
downloadcpython-git-62674f3a36ec55f86a5f20ee028a37fbd549bd6c.tar.gz
bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077)
* bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference. (cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 3118b55c87..ff3a240f2e 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -352,7 +352,10 @@ get_attrib_from_keywords(PyObject *kwds)
return NULL;
}
attrib = PyDict_Copy(attrib);
- PyDict_DelItem(kwds, attrib_str);
+ if (attrib && PyDict_DelItem(kwds, attrib_str) < 0) {
+ Py_DECREF(attrib);
+ attrib = NULL;
+ }
} else {
attrib = PyDict_New();
}