mirror of https://github.com/python/cpython.git
Avoid a potential double-free bug.
This commit is contained in:
parent
ba29e4c573
commit
e502693ee9
|
@ -3191,8 +3191,10 @@ CFuncPtr_clear(CFuncPtrObject *self)
|
||||||
Py_CLEAR(self->converters);
|
Py_CLEAR(self->converters);
|
||||||
Py_CLEAR(self->paramflags);
|
Py_CLEAR(self->paramflags);
|
||||||
|
|
||||||
if (self->thunk)
|
if (self->thunk) {
|
||||||
FreeCallback(self->thunk);
|
FreeCallback(self->thunk);
|
||||||
|
PyMem_Free(self->thunk);
|
||||||
|
}
|
||||||
self->thunk = NULL;
|
self->thunk = NULL;
|
||||||
|
|
||||||
return CData_clear((CDataObject *)self);
|
return CData_clear((CDataObject *)self);
|
||||||
|
|
|
@ -292,7 +292,6 @@ static void closure_fcn(ffi_cif *cif,
|
||||||
void FreeCallback(THUNK thunk)
|
void FreeCallback(THUNK thunk)
|
||||||
{
|
{
|
||||||
FreeClosure(((ffi_info *)thunk)->pcl);
|
FreeClosure(((ffi_info *)thunk)->pcl);
|
||||||
PyMem_Free(thunk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
THUNK AllocFunctionCallback(PyObject *callable,
|
THUNK AllocFunctionCallback(PyObject *callable,
|
||||||
|
|
Loading…
Reference in New Issue