summaryrefslogtreecommitdiffstats
path: root/engines/e_capi.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2012-02-11 23:13:10 +0000
committerDr. Stephen Henson <steve@openssl.org>2012-02-11 23:13:10 +0000
commite626c77808544b28721b34f96a0167ff5e088bde (patch)
tree17ec9818f4fb21e38273808f4bc74a7df048875b /engines/e_capi.c
parentda2a5a79efd785ec5e93cd2b5d1662a7f5b72abf (diff)
PR: 2703
Submitted by: Alexey Melnikov <alexey.melnikov@isode.com> Fix some memory and resource leaks in CAPI ENGINE.
Diffstat (limited to 'engines/e_capi.c')
-rw-r--r--engines/e_capi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/engines/e_capi.c b/engines/e_capi.c
index d8d976d2e1..791629f083 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -1193,6 +1193,7 @@ static int capi_list_containers(CAPI_CTX *ctx, BIO *out)
{
CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, CAPI_R_ENUMCONTAINERS_ERROR);
capi_addlasterror();
+ CryptReleaseContext(hprov, 0);
return 0;
}
CAPI_trace(ctx, "Got max container len %d\n", buflen);
@@ -1659,6 +1660,8 @@ static int capi_ctx_set_provname(CAPI_CTX *ctx, LPSTR pname, DWORD type, int che
}
CryptReleaseContext(hprov, 0);
}
+ if (ctx->cspname)
+ OPENSSL_free(ctx->cspname);
ctx->cspname = BUF_strdup(pname);
ctx->csptype = type;
return 1;
@@ -1668,9 +1671,12 @@ static int capi_ctx_set_provname_idx(CAPI_CTX *ctx, int idx)
{
LPSTR pname;
DWORD type;
+ int res;
if (capi_get_provname(ctx, &pname, &type, idx) != 1)
return 0;
- return capi_ctx_set_provname(ctx, pname, type, 0);
+ res = capi_ctx_set_provname(ctx, pname, type, 0);
+ OPENSSL_free(pname);
+ return res;
}
static int cert_issuer_match(STACK_OF(X509_NAME) *ca_dn, X509 *x)