From: Neal Norwitz Date: Sat, 28 Oct 2006 21:39:10 +0000 (+0000) Subject: Backport 52505: X-Git-Tag: v2.5.1c1~285 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0cf624747a35a6db2f632607e7788b8e66d0954;p=thirdparty%2FPython%2Fcpython.git Backport 52505: Prevent crash if alloc of garbage fails. Found by Typo.pl. --- diff --git a/Objects/listobject.c b/Objects/listobject.c index 7afea121cdd5..739a571b9b5b 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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);