summaryrefslogtreecommitdiffstats
path: root/Objects
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)
commit47770ed914606282b5e251d03a17b90795ec347a (patch)
treecae6a7523817c2c3c6470b7e63b4f31096eefc1c /Objects
parent7a8634d8d86041e47b283717424eb2b3cede8c84 (diff)
downloadcpython-47770ed914606282b5e251d03a17b90795ec347a.zip
cpython-47770ed914606282b5e251d03a17b90795ec347a.tar.gz
cpython-47770ed914606282b5e251d03a17b90795ec347a.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
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 e527eed..339e69e 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2984,8 +2984,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 && strcmp(PyString_AS_STRING(mod), "__builtin__"))
rtn = PyString_FromFormat("<%s.%s object at %p>",
PyString_AS_STRING(mod),