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

neal.norwitz python-checkins at python.org
Sat Aug 19 06:23:04 CEST 2006


Author: neal.norwitz
Date: Sat Aug 19 06:23:04 2006
New Revision: 51401

Modified:
   python/trunk/Modules/_ctypes/stgdict.c
Log:
Move assert to after NULL check, otherwise we deref NULL in the assert.

Klocwork #307


Modified: python/trunk/Modules/_ctypes/stgdict.c
==============================================================================
--- python/trunk/Modules/_ctypes/stgdict.c	(original)
+++ python/trunk/Modules/_ctypes/stgdict.c	Sat Aug 19 06:23:04 2006
@@ -208,12 +208,12 @@
 			continue;
 		}
  		new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&CField_Type, NULL);
-		assert(new_descr->ob_type == &CField_Type);
 		if (new_descr == NULL) {
 			Py_DECREF(fdescr);
 			Py_DECREF(fieldlist);
 			return -1;
 		}
+		assert(new_descr->ob_type == &CField_Type);
  		new_descr->size = fdescr->size;
  		new_descr->offset = fdescr->offset + offset;
  		new_descr->index = fdescr->index + index;


More information about the Python-checkins mailing list