diff options
author | Thomas Heller <theller@ctypes.org> | 2006-03-20 14:22:05 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-03-20 14:22:05 (GMT) |
commit | e502693ee9af3a8f614dbc67dc56454bb31d310e (patch) | |
tree | 23f9f0cb4aaa5a6e27caed59891f591de94816ae /Modules | |
parent | ba29e4c573bba3650744082276db9afb85e03c3c (diff) | |
download | cpython-e502693ee9af3a8f614dbc67dc56454bb31d310e.zip cpython-e502693ee9af3a8f614dbc67dc56454bb31d310e.tar.gz cpython-e502693ee9af3a8f614dbc67dc56454bb31d310e.tar.bz2 |
Avoid a potential double-free bug.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 4 | ||||
-rw-r--r-- | Modules/_ctypes/callbacks.c | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index ac4859e..daaec02 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -3191,8 +3191,10 @@ CFuncPtr_clear(CFuncPtrObject *self) Py_CLEAR(self->converters); Py_CLEAR(self->paramflags); - if (self->thunk) + if (self->thunk) { FreeCallback(self->thunk); + PyMem_Free(self->thunk); + } self->thunk = NULL; return CData_clear((CDataObject *)self); diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 286faa3..4b1ca58 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -292,7 +292,6 @@ static void closure_fcn(ffi_cif *cif, void FreeCallback(THUNK thunk) { FreeClosure(((ffi_info *)thunk)->pcl); - PyMem_Free(thunk); } THUNK AllocFunctionCallback(PyObject *callable, |