Commit e502693e authored by Thomas Heller's avatar Thomas Heller

Avoid a potential double-free bug.

parent ba29e4c5
...@@ -3191,8 +3191,10 @@ CFuncPtr_clear(CFuncPtrObject *self) ...@@ -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, ...@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment