summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-06-10 22:01:50 (GMT)
committerThomas Heller <theller@ctypes.org>2006-06-10 22:01:50 (GMT)
commit9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd (patch)
tree1368cd5e46376dab76f8cabd92e8d33ff1b39202 /Modules
parent9123edcc63bfbe3417d452922dda947a2fa179b8 (diff)
downloadcpython-9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd.zip
cpython-9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd.tar.gz
cpython-9af2b44805bb4c69e93a4ad6ce3c6ee3c2bb54cd.tar.bz2
Handle failure of PyMem_Realloc.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/callproc.c5
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: