diff options
-rw-r--r-- | Modules/_ctypes/callproc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index e82a6c2..92a6c3c 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: |