summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-10-20 04:15:52 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-10-20 04:15:52 (GMT)
commit95c1e5065ca572a4a3f602487ff6112f089a9257 (patch)
tree1d7ba512de9a8e529337aafad7ebe86c535392fa /Objects
parent5c4a9d65910e05c4381f96e6af56ee2743abd0d5 (diff)
downloadcpython-95c1e5065ca572a4a3f602487ff6112f089a9257.zip
cpython-95c1e5065ca572a4a3f602487ff6112f089a9257.tar.gz
cpython-95c1e5065ca572a4a3f602487ff6112f089a9257.tar.bz2
SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c2
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++) {