summaryrefslogtreecommitdiff
path: root/p11-kit/proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit/proxy.c')
-rw-r--r--p11-kit/proxy.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/p11-kit/proxy.c b/p11-kit/proxy.c
index 31b9bb2..b7fb63d 100644
--- a/p11-kit/proxy.c
+++ b/p11-kit/proxy.c
@@ -1720,8 +1720,8 @@ p11_proxy_module_cleanup (void)
for (; state != NULL; state = next) {
next = state->next;
- p11_virtual_unwrap (state->wrapped);
p11_kit_modules_release (state->loaded);
+ p11_virtual_unwrap (state->wrapped);
}
}
@@ -1731,16 +1731,6 @@ p11_proxy_module_check (CK_FUNCTION_LIST_PTR module)
return (module->C_WaitForSlotEvent == module_C_WaitForSlotEvent);
}
-static void
-proxy_module_free (p11_virtual *virt)
-{
- State *state = (State *)virt;
-
- p11_virtual_unwrap (state->wrapped);
- p11_kit_modules_release (state->loaded);
- free (state);
-}
-
CK_RV
p11_proxy_module_create (CK_FUNCTION_LIST_PTR *module,
CK_FUNCTION_LIST_PTR *modules)
@@ -1758,9 +1748,10 @@ p11_proxy_module_create (CK_FUNCTION_LIST_PTR *module,
p11_virtual_init (&state->virt, &proxy_functions, state, NULL);
state->last_handle = FIRST_HANDLE;
state->loaded = modules_dup (modules);
- state->wrapped = p11_virtual_wrap (&state->virt, (p11_destroyer)proxy_module_free);
+ state->wrapped = p11_virtual_wrap (&state->virt, (p11_destroyer)p11_virtual_uninit);
if (state->wrapped == NULL) {
- proxy_module_free (&state->virt);
+ p11_kit_modules_release (state->loaded);
+ free (state);
return CKR_GENERAL_ERROR;
}