From a090b46f727b9ccd0efd97cce0f870d56ad31519 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 29 Sep 2013 14:17:45 +0200 Subject: [PATCH] wintrust: Fixed some memory leaks (Coverity). --- dlls/wintrust/crypt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c index 341f45bd59f..0ed45d39800 100644 --- a/dlls/wintrust/crypt.c +++ b/dlls/wintrust/crypt.c @@ -909,6 +909,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, NULL, &size)) { CryptMsgClose(hmsg); + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } sum += size; @@ -916,6 +917,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h if (!(cc->attr = HeapAlloc(GetProcessHeap(), 0, sizeof(*cc->attr) * cc->attr_count + sum))) { CryptMsgClose(hmsg); + HeapFree(GetProcessHeap(), 0, cc); SetLastError(ERROR_OUTOFMEMORY); return INVALID_HANDLE_VALUE; } @@ -926,12 +928,14 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h { CryptMsgClose(hmsg); HeapFree(GetProcessHeap(), 0, cc->attr); + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, p, &size)) { CryptMsgClose(hmsg); HeapFree(GetProcessHeap(), 0, cc->attr); + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } p += size; @@ -948,6 +952,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h cc->magic = CRYPTCAT_MAGIC; return cc; } + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; }