summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 15:00:30 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 15:00:30 (GMT)
commit76c082911b69c5f3bb2bee9aadef0a0ea9162eac (patch)
tree6afe1a3edaa57bcd731810ebdd97aa1ff230f28b /Objects
parent10e85ded9bd2d8dabb06a67ab21010ad75f430d1 (diff)
parente81dc296f287ca20ebfebda8de2fbcca5580d666 (diff)
downloadcpython-76c082911b69c5f3bb2bee9aadef0a0ea9162eac.zip
cpython-76c082911b69c5f3bb2bee9aadef0a0ea9162eac.tar.gz
cpython-76c082911b69c5f3bb2bee9aadef0a0ea9162eac.tar.bz2
Fixed memory leak in error branch of object_repr which may leak a reference to mod when type_qualname returns NULL. CID 715371
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 f51700e..88cca93 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3130,8 +3130,10 @@ object_repr(PyObject *self)
mod = NULL;
}
name = type_qualname(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