]> granicus.if.org Git - python/commitdiff
bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array(...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 14 Nov 2017 07:01:29 +0000 (23:01 -0800)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 14 Nov 2017 07:01:29 +0000 (09:01 +0200)
(cherry picked from commit 56935a53b11b9a70f3e13e460777ec81a5b9195e)

Modules/arraymodule.c

index 64e0f172fd7d821305911d15b9825a05adc7e134..9254af59a6a2d61fcfdde92df7ba3ccf3a45bc33 100644 (file)
@@ -1885,8 +1885,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);