From: Daiki Ueno Date: Mon, 26 Feb 2018 13:51:43 +0000 (+0100) Subject: client: Fix memleaks in the module X-Git-Tag: 0.23.10~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47297f9785a21af1bb79450bad549aa8bd33a24c;p=p11-kit client: Fix memleaks in the module --- diff --git a/p11-kit/client.c b/p11-kit/client.c index 26b2e74..698a8c3 100644 --- a/p11-kit/client.c +++ b/p11-kit/client.c @@ -186,14 +186,19 @@ C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list) 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) { @@ -222,5 +227,6 @@ p11_client_module_cleanup (void) next = state->next; p11_rpc_transport_free (state->rpc); p11_virtual_unwrap (state->wrapped); + free (state); } }