capi_get_provname: free name on error if it was malloc'ed

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Jonas Maebe 2013-12-08 23:04:54 +01:00 committed by Kurt Roeckx
parent 0716f9e405
commit e2140501fd

View File

@ -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);