From: Neal Norwitz Date: Sat, 28 Oct 2006 21:20:12 +0000 (+0000) Subject: Prevent crash if alloc of garbage fails. Found by Typo.pl. X-Git-Tag: v2.6a1~2502 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7e4e2dfabe981f3ebb9a22d270c7dac6650ac9c;p=python Prevent crash if alloc of garbage fails. Found by Typo.pl. Will backport. --- diff --git a/Objects/listobject.c b/Objects/listobject.c index bf4466a1a2..a1ac2cba10 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2608,6 +2608,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);