diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-10-28 21:39:10 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-10-28 21:39:10 +0000 |
commit | e0cf624747a35a6db2f632607e7788b8e66d0954 (patch) | |
tree | 0c565f7d5ca49e8b23ab3e8b504e8f03e1239709 | |
parent | 2f0940b6cab766f039dc22d361f52e25b22e9fa8 (diff) | |
download | cpython-git-e0cf624747a35a6db2f632607e7788b8e66d0954.tar.gz |
Backport 52505:
Prevent crash if alloc of garbage fails. Found by Typo.pl.
-rw-r--r-- | Objects/listobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 7afea121cd..739a571b9b 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); |