summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-10-28 21:39:10 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2006-10-28 21:39:10 +0000
commite0cf624747a35a6db2f632607e7788b8e66d0954 (patch)
tree0c565f7d5ca49e8b23ab3e8b504e8f03e1239709
parent2f0940b6cab766f039dc22d361f52e25b22e9fa8 (diff)
downloadcpython-git-e0cf624747a35a6db2f632607e7788b8e66d0954.tar.gz
Backport 52505:
Prevent crash if alloc of garbage fails. Found by Typo.pl.
-rw-r--r--Objects/listobject.c5
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);