From: Thomas Heller Date: Sat, 10 Jun 2006 22:01:50 +0000 (+0000) Subject: Handle failure of PyMem_Realloc. X-Git-Tag: v2.5b1~147 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd;p=thirdparty%2FPython%2Fcpython.git Handle failure of PyMem_Realloc. --- diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index e82a6c2b9a2e..92a6c3c63b2a 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1492,7 +1492,10 @@ resize(PyObject *self, PyObject *args) obj->b_ptr = ptr; obj->b_size = size; } else { - obj->b_ptr = PyMem_Realloc(obj->b_ptr, size); + void * ptr = PyMem_Realloc(obj->b_ptr, size); + if (ptr == NULL) + return PyErr_NoMemory(); + obj->b_ptr = ptr; obj->b_size = size; } done: