summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-11-14 07:01:29 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-11-14 07:01:29 (GMT)
commit18056fb11e6fe6e5247cd03073bd74df8ac0acc7 (patch)
treee37617a7d0f4dbb0b5be2b9abbfd7001406af602 /Modules
parent6ed9d4ecde8c3f0eeadf188f15a5bbd32b9d1145 (diff)
downloadcpython-18056fb11e6fe6e5247cd03073bd74df8ac0acc7.zip
cpython-18056fb11e6fe6e5247cd03073bd74df8ac0acc7.tar.gz
cpython-18056fb11e6fe6e5247cd03073bd74df8ac0acc7.tar.bz2
bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of make_array() (GH-4391) (#4392)
(cherry picked from commit 56935a53b11b9a70f3e13e460777ec81a5b9195e)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/arraymodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 64e0f17..9254af5 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);