summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 01:00:14 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 01:00:14 (GMT)
commita0e7e41cba6c75f493a64ce09037cecb60642190 (patch)
treebbb4f38eb7056a6e6342c909c502b33c8ade5a45 /Objects
parentd5a88044a3fe666c63db99a2b58561f726728664 (diff)
downloadcpython-a0e7e41cba6c75f493a64ce09037cecb60642190.zip
cpython-a0e7e41cba6c75f493a64ce09037cecb60642190.tar.gz
cpython-a0e7e41cba6c75f493a64ce09037cecb60642190.tar.bz2
Fixed possible reference leak to mod when type_name() returns NULL
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 1bda375..e34b10c 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);