From: Jonas Maebe Date: Sun, 8 Dec 2013 22:04:54 +0000 (+0100) Subject: capi_get_provname: free name on error if it was malloc'ed X-Git-Tag: master-pre-reformat~184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2140501fd366c5af617f9210160e383cf4b2c86;p=openssl capi_get_provname: free name on error if it was malloc'ed Signed-off-by: Kurt Roeckx Reviewed-by: Richard Levitte --- diff --git a/engines/e_capi.c b/engines/e_capi.c index d4221cbae3..f06d298324 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -1155,6 +1155,8 @@ static int capi_get_provname(CAPI_CTX *ctx, LPSTR *pname, DWORD *ptype, DWORD id if (!CryptEnumProviders(idx, NULL, 0, ptype, name, &len)) { err = GetLastError(); + if (sizeof(TCHAR) == sizeof(char)) + OPENSSL_free(name); if (err == ERROR_NO_MORE_ITEMS) return 2; CAPIerr(CAPI_F_CAPI_GET_PROVNAME, CAPI_R_CRYPTENUMPROVIDERS_ERROR);