[Python-checkins] r43175 - python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Modules/_ctypes/callbacks.c
thomas.heller
python-checkins at python.org
Mon Mar 20 15:22:05 CET 2006
Author: thomas.heller
Date: Mon Mar 20 15:22:05 2006
New Revision: 43175
Modified:
python/trunk/Modules/_ctypes/_ctypes.c
python/trunk/Modules/_ctypes/callbacks.c
Log:
Avoid a potential double-free bug.
Modified: python/trunk/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/trunk/Modules/_ctypes/_ctypes.c (original)
+++ python/trunk/Modules/_ctypes/_ctypes.c Mon Mar 20 15:22:05 2006
@@ -3191,8 +3191,10 @@
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);
Modified: python/trunk/Modules/_ctypes/callbacks.c
==============================================================================
--- python/trunk/Modules/_ctypes/callbacks.c (original)
+++ python/trunk/Modules/_ctypes/callbacks.c Mon Mar 20 15:22:05 2006
@@ -292,7 +292,6 @@
void FreeCallback(THUNK thunk)
{
FreeClosure(((ffi_info *)thunk)->pcl);
- PyMem_Free(thunk);
}
THUNK AllocFunctionCallback(PyObject *callable,
More information about the Python-checkins
mailing list