SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport

This commit is contained in:
Neal Norwitz 2005-10-20 04:15:52 +00:00
parent 5c4a9d6591
commit 95c1e5065c
1 changed files with 2 additions and 0 deletions

View File

@ -1198,6 +1198,8 @@ string_subscript(PyStringObject* self, PyObject* item)
else {
source_buf = PyString_AsString((PyObject*)self);
result_buf = PyMem_Malloc(slicelength);
if (result_buf == NULL)
return PyErr_NoMemory();
for (cur = start, i = 0; i < slicelength;
cur += step, i++) {