diff Modules/arraymodule.c @ 36878:accfb156f9cc 2.4

Backport r42894: SF #1444030 Fix several potential defects found by Coverity.
author Hye-Shik Chang <hyeshik@gmail.com>
date Tue, 07 Mar 2006 15:59:09 +0000
parents 97c97194e64b
children adbfd8d5851c
line wrap: on
line diff
--- a/Modules/arraymodule.c	Tue Mar 07 14:16:02 2006 +0000
+++ b/Modules/arraymodule.c	Tue Mar 07 15:59:09 2006 +0000
@@ -1826,10 +1826,13 @@
 					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) {