diff Objects/stringobject.c @ 35731:0b8268e0d70e 2.4

Backport: SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc.
author Neal Norwitz <nnorwitz@gmail.com>
date Thu, 20 Oct 2005 04:16:45 +0000
parents 10512ceba30c
children accfb156f9cc
line wrap: on
line diff
--- a/Objects/stringobject.c	Sat Oct 15 16:44:57 2005 +0000
+++ b/Objects/stringobject.c	Thu Oct 20 04:16:45 2005 +0000
@@ -1184,6 +1184,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++) {