state->rpc = p11_rpc_transport_new (&state->virt,
address,
"client");
- if (!state->rpc)
+ if (!state->rpc) {
+ free (state);
rv = CKR_GENERAL_ERROR;
+ }
}
if (rv == CKR_OK) {
- module = p11_virtual_wrap (&state->virt, free);
- if (!module)
+ module = p11_virtual_wrap (&state->virt, (p11_destroyer)p11_virtual_uninit);
+ if (!module) {
+ p11_rpc_transport_free (state->rpc);
+ free (state);
rv = CKR_GENERAL_ERROR;
+ }
}
if (rv == CKR_OK) {
next = state->next;
p11_rpc_transport_free (state->rpc);
p11_virtual_unwrap (state->wrapped);
+ free (state);
}
}