mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)
https://bugs.python.org/issue36745
This commit is contained in:
parent
da63b321f6
commit
e0dcb85b7d
1 changed files with 3 additions and 1 deletions
|
@ -1044,8 +1044,10 @@ PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
|
|||
}
|
||||
if (tp->tp_setattr != NULL) {
|
||||
const char *name_str = PyUnicode_AsUTF8(name);
|
||||
if (name_str == NULL)
|
||||
if (name_str == NULL) {
|
||||
Py_DECREF(name);
|
||||
return -1;
|
||||
}
|
||||
err = (*tp->tp_setattr)(v, (char *)name_str, value);
|
||||
Py_DECREF(name);
|
||||
return err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue