summaryrefslogtreecommitdiff
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-10-20 04:15:52 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2005-10-20 04:15:52 +0000
commitfdbba2026b5193e1ed2953f7329dfae380421180 (patch)
tree8f3786ebe1099f16d23ca52c6a3524d127073f40 /Objects/stringobject.c
parent42f987da2c750e2373028b71a1bb16ed5f0a19df (diff)
downloadcpython-fdbba2026b5193e1ed2953f7329dfae380421180.tar.gz
SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 5797eb91ef..78560de9d6 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++) {