diff options
| author | Neal Norwitz <nnorwitz@gmail.com> | 2006-10-28 21:39:10 (GMT) |
|---|---|---|
| committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-10-28 21:39:10 (GMT) |
| commit | e0cf624747a35a6db2f632607e7788b8e66d0954 (patch) | |
| tree | 0c565f7d5ca49e8b23ab3e8b504e8f03e1239709 | |
| parent | 2f0940b6cab766f039dc22d361f52e25b22e9fa8 (diff) | |
| download | cpython-e0cf624747a35a6db2f632607e7788b8e66d0954.zip cpython-e0cf624747a35a6db2f632607e7788b8e66d0954.tar.gz cpython-e0cf624747a35a6db2f632607e7788b8e66d0954.tar.bz2 | |
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 7afea12..739a571 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); |
