Commit a090b46f authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

wintrust: Fixed some memory leaks (Coverity).

parent e9358909
...@@ -909,6 +909,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h ...@@ -909,6 +909,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, NULL, &size)) if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, NULL, &size))
{ {
CryptMsgClose(hmsg); CryptMsgClose(hmsg);
HeapFree(GetProcessHeap(), 0, cc);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
sum += size; sum += size;
...@@ -916,6 +917,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h ...@@ -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))) if (!(cc->attr = HeapAlloc(GetProcessHeap(), 0, sizeof(*cc->attr) * cc->attr_count + sum)))
{ {
CryptMsgClose(hmsg); CryptMsgClose(hmsg);
HeapFree(GetProcessHeap(), 0, cc);
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
...@@ -926,12 +928,14 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h ...@@ -926,12 +928,14 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
{ {
CryptMsgClose(hmsg); CryptMsgClose(hmsg);
HeapFree(GetProcessHeap(), 0, cc->attr); HeapFree(GetProcessHeap(), 0, cc->attr);
HeapFree(GetProcessHeap(), 0, cc);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, p, &size)) if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, p, &size))
{ {
CryptMsgClose(hmsg); CryptMsgClose(hmsg);
HeapFree(GetProcessHeap(), 0, cc->attr); HeapFree(GetProcessHeap(), 0, cc->attr);
HeapFree(GetProcessHeap(), 0, cc);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
p += size; p += size;
...@@ -948,6 +952,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h ...@@ -948,6 +952,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
cc->magic = CRYPTCAT_MAGIC; cc->magic = CRYPTCAT_MAGIC;
return cc; return cc;
} }
HeapFree(GetProcessHeap(), 0, cc);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment