From: Stéphane Wirtel Date: Mon, 12 Jun 2017 13:30:48 +0000 (+0200) Subject: bpo-30615: Fix the leak reference in Modules/_elementtree.c (#2129) X-Git-Tag: v2.7.14rc1~102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41af942e57f9a450cf273ef6b72a21380c6ba8d1;p=python bpo-30615: Fix the leak reference in Modules/_elementtree.c (#2129) --- diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index b9e9b3aff8..929616f3e2 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);