[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 09:17:44 EDT 2019


https://github.com/python/cpython/commit/896c6357f3267fe5dc5a33979f8cf46b0a74cfee
commit: 896c6357f3267fe5dc5a33979f8cf46b0a74cfee
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019年04月28日T06:17:40-07:00
summary:
bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)
https://bugs.python.org/issue36745
(cherry picked from commit e0dcb85b7d64153d1741698c04a6736c9669603a)
Co-authored-by: Zackery Spytz <zspytz at gmail.com>
files:
M Objects/object.c
diff --git a/Objects/object.c b/Objects/object.c
index 420af9465b5c..8a3f8831d6e9 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1017,8 +1017,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 によって変換されたページ (->オリジナル) /