From a0e7e41cba6c75f493a64ce09037cecb60642190 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 10 Sep 2012 03:00:14 +0200 Subject: [PATCH] Fixed possible reference leak to mod when type_name() returns NULL --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 1bda375c3d2..e34b10ce40a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -647,8 +647,10 @@ type_repr(PyTypeObject *type) 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("", mod, name);