[Python-checkins] Fix a possible refleak in tupleobject.c (GH-19018)

Miss Islington (bot) webhook-mailer at python.org
Sun Mar 15 15:55:47 EDT 2020


https://github.com/python/cpython/commit/890dcfe4035888f70207eaac05662d6e29606214
commit: 890dcfe4035888f70207eaac05662d6e29606214
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020年03月15日T12:55:39-07:00
summary:
Fix a possible refleak in tupleobject.c (GH-19018)
(cherry picked from commit c81609e44eed641d3b8a137daa31ef35501c1f85)
Co-authored-by: Hai Shi <shihai1992 at gmail.com>
files:
M Objects/tupleobject.c
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index fc2d2742dd2ca..bd580946b7eb9 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -719,8 +719,10 @@ tuple_subtype_new(PyTypeObject *type, PyObject *iterable)
 return NULL;
 assert(PyTuple_Check(tmp));
 newobj = type->tp_alloc(type, n = PyTuple_GET_SIZE(tmp));
- if (newobj == NULL)
+ if (newobj == NULL) {
+ Py_DECREF(tmp);
 return NULL;
+ }
 for (i = 0; i < n; i++) {
 item = PyTuple_GET_ITEM(tmp, i);
 Py_INCREF(item);


More information about the Python-checkins mailing list

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