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

thomas.heller python-checkins at python.org
Mon Aug 14 09:50:14 CEST 2006


Author: thomas.heller
Date: Mon Aug 14 09:50:14 2006
New Revision: 51266

Modified:
   python/trunk/Modules/_ctypes/_ctypes.c
Log:
Check for NULL return value of GenericCData_new().
Fixes klockwork issues #188, #189.

Modified: python/trunk/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/trunk/Modules/_ctypes/_ctypes.c	(original)
+++ python/trunk/Modules/_ctypes/_ctypes.c	Mon Aug 14 09:50:14 2006
@@ -2752,6 +2752,8 @@
 		if (ptr == NULL)
 			return NULL;
 		ob = (CDataObject *)GenericCData_new(type, args, kwds);
+		if (ob == NULL)
+			return NULL;
 		*(void **)ob->b_ptr = ptr;
 		return (PyObject *)ob;
 	}
@@ -2799,6 +2801,8 @@
 		return NULL;
 
 	self = (CFuncPtrObject *)GenericCData_new(type, args, kwds);
+	if (self == NULL)
+		return NULL;
 
 	Py_INCREF(callable);
 	self->callable = callable;


More information about the Python-checkins mailing list