]> granicus.if.org Git - python/commitdiff
bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array(...
authorMat M <mathew1800@gmail.com>
Tue, 14 Nov 2017 06:00:54 +0000 (01:00 -0500)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 14 Nov 2017 06:00:54 +0000 (08:00 +0200)
Modules/arraymodule.c

index 4f778a2dea3ec336be1691770ef86e4625de5ffc..8c3f0a1c6c646539293f369b66f727516e8b14bb 100644 (file)
@@ -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);