diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-19 04:18:39 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-19 04:18:39 +0000 |
commit | 03ee62c352e66de6070e38d3e3cfc869b6a0a4e1 (patch) | |
tree | 09c6dd6d685f05ee8bcfe8edc99f0710b2850bf9 | |
parent | e12b9f63ecf93b51262119d11f85f3c18bad30e3 (diff) | |
download | cpython-git-03ee62c352e66de6070e38d3e3cfc869b6a0a4e1.tar.gz |
Move assert to after NULL check, otherwise we deref NULL in the assert.
Klocwork #307
-rw-r--r-- | Modules/_ctypes/stgdict.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c index 149a7ea5e8..182b9af036 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; |