The patch fixes a couple of memory leaks and one resource leak on a
failure case. It is against 1.0.0f but should work for 0.9.8 as well.
--- orig.e_capi.c 2012-02-03 14:21:45.929699600 +0000
+++ e_capi.c 2012-02-03 14:28:43.371575900 +0000
@@ -1156,6 +1156,7 @@
{
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);
@@ -1573,6 +1574,8 @@
}
CryptReleaseContext(hprov, 0);
}
+ if (ctx->cspname)
+ OPENSSL_free(ctx->cspname);
ctx->cspname = BUF_strdup(pname);
ctx->csptype = type;
return 1;
@@ -1582,9 +1585,12 @@
{
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)