summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index be12775..2318739 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1852,10 +1852,13 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(v);
}
} else if (initial != NULL && PyString_Check(initial)) {
- PyObject *t_initial = PyTuple_Pack(1,
- initial);
- PyObject *v =
- array_fromstring((arrayobject *)a,
+ PyObject *t_initial, *v;
+ t_initial = PyTuple_Pack(1, initial);
+ if (t_initial == NULL) {
+ Py_DECREF(a);
+ return NULL;
+ }
+ v = array_fromstring((arrayobject *)a,
t_initial);
Py_DECREF(t_initial);
if (v == NULL) {