diff options
author | Thomas Heller <theller@ctypes.org> | 2006-06-10 22:01:50 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-06-10 22:01:50 (GMT) |
commit | 9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd (patch) | |
tree | 1368cd5e46376dab76f8cabd92e8d33ff1b39202 | |
parent | 9123edcc63bfbe3417d452922dda947a2fa179b8 (diff) | |
download | cpython-9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd.zip cpython-9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd.tar.gz cpython-9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd.tar.bz2 |
Handle failure of PyMem_Realloc.
-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: |