* not be defined. This is checked in configure.ac
*/
+/*
+ * Since libffi uses shared memory to store that, releasing it
+ * will cause issues on any other child or parent process that relies
+ * on that. Don't release it.
+ */
+#define LIBFFI_FREE_CLOSURES 0
+
#include "ffi.h"
#ifndef FFI_CLOSURES
#error "FFI_CLOSURES should be checked in configure.ac"
return true;
}
+#if LIBFFI_FREE_CLOSURES
static void
uninit_wrapper_funcs (Wrapper *wrapper)
{
for (i = 0; i < wrapper->ffi_used; i++)
ffi_closure_free (wrapper->ffi_closures[i]);
}
+#endif
CK_FUNCTION_LIST *
p11_virtual_wrap (p11_virtual *virt,
if (wrapper->destroyer)
(wrapper->destroyer) (wrapper->virt);
+#if LIBFFI_FREE_CLOSURES
uninit_wrapper_funcs (wrapper);
+#endif
free (wrapper);
}