From: Mat M Date: Tue, 14 Nov 2017 06:00:54 +0000 (-0500) Subject: bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array(... X-Git-Tag: v3.7.0a3~173 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56935a53b11b9a70f3e13e460777ec81a5b9195e;p=python bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array() (#4391) --- diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 4f778a2dea..8c3f0a1c6c 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1928,8 +1928,10 @@ make_array(PyTypeObject *arraytype, char typecode, PyObject *items) return NULL; new_args = PyTuple_New(2); - if (new_args == NULL) + if (new_args == NULL) { + Py_DECREF(typecode_obj); return NULL; + } Py_INCREF(items); PyTuple_SET_ITEM(new_args, 0, typecode_obj); PyTuple_SET_ITEM(new_args, 1, items);