mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Move assert to after NULL check, otherwise we deref NULL in the assert.
Klocwork #307
This commit is contained in:
parent
6cbb726539
commit
9b17eba8be
1 changed files with 1 additions and 1 deletions
|
@ -208,12 +208,12 @@ MakeFields(PyObject *type, CFieldObject *descr,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&CField_Type, NULL);
|
new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&CField_Type, NULL);
|
||||||
assert(new_descr->ob_type == &CField_Type);
|
|
||||||
if (new_descr == NULL) {
|
if (new_descr == NULL) {
|
||||||
Py_DECREF(fdescr);
|
Py_DECREF(fdescr);
|
||||||
Py_DECREF(fieldlist);
|
Py_DECREF(fieldlist);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
assert(new_descr->ob_type == &CField_Type);
|
||||||
new_descr->size = fdescr->size;
|
new_descr->size = fdescr->size;
|
||||||
new_descr->offset = fdescr->offset + offset;
|
new_descr->offset = fdescr->offset + offset;
|
||||||
new_descr->index = fdescr->index + index;
|
new_descr->index = fdescr->index + index;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue