[Python-checkins] r52511 - python/branches/release25-maint/Objects/listobject.c

neal.norwitz python-checkins at python.org
Sat Oct 28 23:39:11 CEST 2006


Author: neal.norwitz
Date: Sat Oct 28 23:39:10 2006
New Revision: 52511

Modified:
   python/branches/release25-maint/Objects/listobject.c
Log:
Backport 52505:
Prevent crash if alloc of garbage fails.  Found by Typo.pl.


Modified: python/branches/release25-maint/Objects/listobject.c
==============================================================================
--- python/branches/release25-maint/Objects/listobject.c	(original)
+++ python/branches/release25-maint/Objects/listobject.c	Sat Oct 28 23:39:10 2006
@@ -2606,6 +2606,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