summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-19 04:23:04 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-19 04:23:04 (GMT)
commit9b17eba8be14d258a9d4e747b35c3f7ef22f81ca (patch)
treef51fe7aa5d18a9d3ffbe377fbd8cd261f03177b6 /Modules
parent6cbb72653919e64a1b33b11a18604d42a928dcb4 (diff)
downloadcpython-9b17eba8be14d258a9d4e747b35c3f7ef22f81ca.zip
cpython-9b17eba8be14d258a9d4e747b35c3f7ef22f81ca.tar.gz
cpython-9b17eba8be14d258a9d4e747b35c3f7ef22f81ca.tar.bz2
Move assert to after NULL check, otherwise we deref NULL in the assert.
Klocwork #307
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/stgdict.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 149a7ea..182b9af 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -208,12 +208,12 @@ MakeFields(PyObject *type, CFieldObject *descr,
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;