Backport 52505:

Prevent crash if alloc of garbage fails.  Found by Typo.pl.
This commit is contained in:
Neal Norwitz 2006-10-28 21:39:10 +00:00
parent 2f0940b6ca
commit e0cf624747
1 changed files with 5 additions and 0 deletions

View File

@ -2606,6 +2606,11 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
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);