summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 03:00:14 +0200
committerChristian Heimes <christian@cheimes.de>2012-09-10 03:00:14 +0200
commita0e7e41cba6c75f493a64ce09037cecb60642190 (patch)
treebbb4f38eb7056a6e6342c909c502b33c8ade5a45
parentd5a88044a3fe666c63db99a2b58561f726728664 (diff)
downloadcpython-git-a0e7e41cba6c75f493a64ce09037cecb60642190.tar.gz
Fixed possible reference leak to mod when type_name() returns NULL
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 1bda375c3d..e34b10ce40 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("<class '%U.%U'>", mod, name);