bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array() (GH-4391) (#4392)

(cherry picked from commit 56935a53b1)
This commit is contained in:
Miss Islington (bot) 2017-11-13 23:01:29 -08:00 committed by Serhiy Storchaka
parent 6ed9d4ecde
commit 18056fb11e
1 changed files with 3 additions and 1 deletions

View File

@ -1885,8 +1885,10 @@ make_array(PyTypeObject *arraytype, char typecode, PyObject *items)
return NULL; return NULL;
new_args = PyTuple_New(2); new_args = PyTuple_New(2);
if (new_args == NULL) if (new_args == NULL) {
Py_DECREF(typecode_obj);
return NULL; return NULL;
}
Py_INCREF(items); Py_INCREF(items);
PyTuple_SET_ITEM(new_args, 0, typecode_obj); PyTuple_SET_ITEM(new_args, 0, typecode_obj);
PyTuple_SET_ITEM(new_args, 1, items); PyTuple_SET_ITEM(new_args, 1, items);