diff options
-rw-r--r-- | Objects/stringobject.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 5797eb9..78560de 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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++) { |