[Python-checkins] r46838 - python/trunk/Modules/_ctypes/callproc.c

thomas.heller python-checkins at python.org
Sun Jun 11 00:01:50 CEST 2006


Author: thomas.heller
Date: Sun Jun 11 00:01:50 2006
New Revision: 46838

Modified:
   python/trunk/Modules/_ctypes/callproc.c
Log:
Handle failure of PyMem_Realloc.

Modified: python/trunk/Modules/_ctypes/callproc.c
==============================================================================
--- python/trunk/Modules/_ctypes/callproc.c	(original)
+++ python/trunk/Modules/_ctypes/callproc.c	Sun Jun 11 00:01:50 2006
@@ -1492,7 +1492,10 @@
 		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:


More information about the Python-checkins mailing list