summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 14:57:36 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 14:57:36 (GMT)
commite81dc296f287ca20ebfebda8de2fbcca5580d666 (patch)
tree0204b9ec54e445b6c710c8601f2ca7cc76afe443
parent3d463393bb068a8ef8e99e00f8cb46d8a2c8631b (diff)
downloadcpython-e81dc296f287ca20ebfebda8de2fbcca5580d666.zip
cpython-e81dc296f287ca20ebfebda8de2fbcca5580d666.tar.gz
cpython-e81dc296f287ca20ebfebda8de2fbcca5580d666.tar.bz2
Fixed memory leak in error branch of object_repr which may leak a reference to mod when type_name returns NULL. CID 715371
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index e34b10c..0fc0ad3 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