From e2140501fd366c5af617f9210160e383cf4b2c86 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 8 Dec 2013 23:04:54 +0100 Subject: [PATCH] capi_get_provname: free name on error if it was malloc'ed Signed-off-by: Kurt Roeckx Reviewed-by: Richard Levitte --- engines/e_capi.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.25.1