[Python-checkins] r52505 - python/trunk/Objects/listobject.c

neal.norwitz python-checkins at python.org
Sat Oct 28 23:20:12 CEST 2006


Author: neal.norwitz
Date: Sat Oct 28 23:20:12 2006
New Revision: 52505

Modified:
   python/trunk/Objects/listobject.c
Log:
Prevent crash if alloc of garbage fails.  Found by Typo.pl.

Will backport.


Modified: python/trunk/Objects/listobject.c
==============================================================================
--- python/trunk/Objects/listobject.c	(original)
+++ python/trunk/Objects/listobject.c	Sat Oct 28 23:20:12 2006
@@ -2608,6 +2608,11 @@
 
 			garbage = (PyObject**)
 				PyMem_MALLOC(slicelength*sizeof(PyObject*));
+			if (!garbage) {
+				Py_DECREF(seq);
+				PyErr_NoMemory();
+				return -1;
+			}
 
 			selfitems = self->ob_item;
 			seqitems = PySequence_Fast_ITEMS(seq);


More information about the Python-checkins mailing list