From: Christian Heimes Date: Mon, 10 Sep 2012 14:57:36 +0000 (+0200) Subject: Fixed memory leak in error branch of object_repr which may leak a reference to mod... X-Git-Tag: v3.2.4rc1~544 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e81dc296f287ca20ebfebda8de2fbcca5580d666;p=thirdparty%2FPython%2Fcpython.git Fixed memory leak in error branch of object_repr which may leak a reference to mod when type_name returns NULL. CID 715371 --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e34b10ce40a0..0fc0ad38e82a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2925,8 +2925,10 @@ object_repr(PyObject *self) mod = NULL; } name = type_name(type, NULL); - if (name == NULL) + if (name == NULL) { + Py_XDECREF(mod); return NULL; + } if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins")) rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self); else