Commit e0dcb85b authored by Zackery Spytz's avatar Zackery Spytz Committed by Miss Islington (bot)

bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)



https://bugs.python.org/issue36745
parent da63b321
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment