diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-05-03 10:53:08 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-05-03 10:53:08 (GMT) |
commit | cd12bfc14264b5ed8f4fae43d5a186f0408b5e61 (patch) | |
tree | 241acd418300643331dec247c27dcd614e4d47f3 /Objects | |
parent | bcd93962ce27d969ff9a186e8e679c2a57620799 (diff) | |
download | cpython-cd12bfc14264b5ed8f4fae43d5a186f0408b5e61.zip cpython-cd12bfc14264b5ed8f4fae43d5a186f0408b5e61.tar.gz cpython-cd12bfc14264b5ed8f4fae43d5a186f0408b5e61.tar.bz2 |
Patch #708604: Check more function results. Will backport to 2.2.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 49d977e..36bbe22 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -473,6 +473,8 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v) /* Special case "a[i:j] = a" -- copy b first */ int ret; v = list_slice(b, 0, n); + if (v == NULL) + return -1; ret = list_ass_slice(a, ilow, ihigh, v); Py_DECREF(v); return ret; @@ -488,8 +490,13 @@ list_ass_slice(PyListObject *a, int ilow, int ihigh, PyObject *v) ihigh = a->ob_size; item = a->ob_item; d = n - (ihigh-ilow); - if (ihigh > ilow) + if (ihigh > ilow) { p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow)); + if (recycle == NULL) { + PyErr_NoMemory(); + return -1; + } + } else p = recycle = NULL; if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */ |