diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-06-24 16:08:42 +0200 |
---|---|---|
committer | Stef Walter <stefw@redhat.com> | 2015-06-29 13:49:10 +0200 |
commit | ec8a291efb87f1751a18c7e023a67232c15a4ef2 (patch) | |
tree | d7a4f9b1f6fcfa797880df34fd0fa5e1a8b19a7d | |
parent | c9095cb154cfd9937332b1a980316d10a9655d51 (diff) |
Do not deinitialize libffi's wrapper functions
Libffi uses shared memory to store them, and a deallocation
in a child will cause issues for the parent or vice versa.
Signed-off-by: Stef Walter <stefw@redhat.com>
* Use #if to comment out code, avoid compiler warnings
-rw-r--r-- | p11-kit/virtual.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/p11-kit/virtual.c b/p11-kit/virtual.c index 2f4f0ae..bb0d845 100644 --- a/p11-kit/virtual.c +++ b/p11-kit/virtual.c @@ -54,6 +54,13 @@ * 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" @@ -2718,6 +2725,7 @@ init_wrapper_funcs (Wrapper *wrapper) return true; } +#if LIBFFI_FREE_CLOSURES static void uninit_wrapper_funcs (Wrapper *wrapper) { @@ -2726,6 +2734,7 @@ 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, @@ -2792,7 +2801,9 @@ p11_virtual_unwrap (CK_FUNCTION_LIST_PTR module) if (wrapper->destroyer) (wrapper->destroyer) (wrapper->virt); +#if LIBFFI_FREE_CLOSURES uninit_wrapper_funcs (wrapper); +#endif free (wrapper); } |