mirror of https://github.com/python/cpython
Fixed memory leak in error branch of object_repr which may leak a reference to mod when type_name returns NULL. CID 715371
This commit is contained in:
parent
7a8634d8d8
commit
47770ed914
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue