[Python-checkins] bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)

Miss Islington (bot) webhook-mailer at python.org
Sun Apr 28 08:59:00 EDT 2019


https://github.com/python/cpython/commit/e0dcb85b7d64153d1741698c04a6736c9669603a
commit: e0dcb85b7d64153d1741698c04a6736c9669603a
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2019年04月28日T05:58:52-07:00
summary:
bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)
https://bugs.python.org/issue36745
files:
M Objects/object.c
diff --git a/Objects/object.c b/Objects/object.c
index e7ec7aec490f..589bf365e870 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;


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /