From 4568603fac2c854272b903c526c6fbcb389a3657 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 12 Jun 2017 14:29:07 +0200 Subject: [PATCH] bpo-30615: Fix the leak reference in Modules/_elementtree.c --- Modules/_elementtree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index b9e9b3aff80f89..929616f3e2e5b7 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1266,8 +1266,10 @@ element_repr(ElementObject* self) if (status == 0) { PyObject *repr, *tag; tag = PyObject_Repr(self->tag); - if (!tag) + if (!tag) { + Py_ReprLeave((PyObject *)self); return NULL; + } repr = PyString_FromFormat("", PyString_AS_STRING(tag), self);