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

Serhiy Storchaka webhook-mailer at python.org
Tue Nov 14 02:01:33 EST 2017


https://github.com/python/cpython/commit/18056fb11e6fe6e5247cd03073bd74df8ac0acc7
commit: 18056fb11e6fe6e5247cd03073bd74df8ac0acc7
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2017-11-14T09:01:29+02:00
summary:

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

(cherry picked from commit 56935a53b11b9a70f3e13e460777ec81a5b9195e)

files:
M Modules/arraymodule.c

diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 64e0f172fd7..9254af59a6a 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -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);



More information about the Python-checkins mailing list