Browse Source

Fix a possible refleak in tupleobject.c (GH-19018)

pull/19026/head
Hai Shi 6 years ago
committed by GitHub
parent
commit
c81609e44e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Objects/tupleobject.c

4
Objects/tupleobject.c

@ -737,8 +737,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);

Loading…
Cancel
Save