mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Fix a possible refleak in tupleobject.c (GH-19018)
This commit is contained in:
parent
8689209e03
commit
c81609e44e
1 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue