diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-04-28 12:58:52 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-04-28 12:58:52 (GMT) |
commit | e0dcb85b7d64153d1741698c04a6736c9669603a (patch) | |
tree | dd62ce772d91b10d090e8a7a0367b1d5442b3ce9 /Objects/object.c | |
parent | da63b321f63b697f75e7ab2f88f55d907f56c187 (diff) | |
download | cpython-e0dcb85b7d64153d1741698c04a6736c9669603a.zip cpython-e0dcb85b7d64153d1741698c04a6736c9669603a.tar.gz cpython-e0dcb85b7d64153d1741698c04a6736c9669603a.tar.bz2 |
bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)
https://bugs.python.org/issue36745
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c index e7ec7ae..589bf36 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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; |