Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 35730:8bec120dbb16 legacy-trunk
SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Thu, 20 Oct 2005 04:15:52 +0000 |
| parents | dc5d706283d6 |
| children | e0e320f36c93 |
line wrap: on
line diff
--- a/Objects/stringobject.c Wed Oct 19 22:39:02 2005 +0000 +++ b/Objects/stringobject.c Thu Oct 20 04:15:52 2005 +0000 @@ -1198,6 +1198,8 @@ 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++) {
