Skip to content

Commit 18056fb

Browse files
miss-islingtonserhiy-storchaka
authored andcommitted
bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array() (GH-4391) (#4392)
(cherry picked from commit 56935a5)
1 parent 6ed9d4e commit 18056fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/arraymodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1885,8 +1885,10 @@ make_array(PyTypeObject *arraytype, char typecode, PyObject *items)
18851885
return NULL;
18861886

18871887
new_args = PyTuple_New(2);
1888-
if (new_args == NULL)
1888+
if (new_args == NULL) {
1889+
Py_DECREF(typecode_obj);
18891890
return NULL;
1891+
}
18901892
Py_INCREF(items);
18911893
PyTuple_SET_ITEM(new_args, 0, typecode_obj);
18921894
PyTuple_SET_ITEM(new_args, 1, items);

0 commit comments

Comments
 (0)