mirror of https://github.com/python/cpython
Check for NULL return value of GenericCData_new().
Fixes klockwork issues #188, #189.
This commit is contained in:
parent
efa2727334
commit
dca703fbda
|
@ -2752,6 +2752,8 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
ob = (CDataObject *)GenericCData_new(type, args, kwds);
|
ob = (CDataObject *)GenericCData_new(type, args, kwds);
|
||||||
|
if (ob == NULL)
|
||||||
|
return NULL;
|
||||||
*(void **)ob->b_ptr = ptr;
|
*(void **)ob->b_ptr = ptr;
|
||||||
return (PyObject *)ob;
|
return (PyObject *)ob;
|
||||||
}
|
}
|
||||||
|
@ -2799,6 +2801,8 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
self = (CFuncPtrObject *)GenericCData_new(type, args, kwds);
|
self = (CFuncPtrObject *)GenericCData_new(type, args, kwds);
|
||||||
|
if (self == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
Py_INCREF(callable);
|
Py_INCREF(callable);
|
||||||
self->callable = callable;
|
self->callable = callable;
|
||||||
|
|
Loading…
Reference in New Issue