[RECYCLEBIN] fix some resource leaks CID 716559 716560

svn path=/trunk/; revision=68960
This commit is contained in:
Christoph von Wittich 2015-09-03 17:35:37 +00:00
parent da0a374ef0
commit d4e8254f9e

View file

@ -222,7 +222,10 @@ RecycleBin5_RecycleBin5_DeleteFile(
/* Check if file exists */ /* Check if file exists */
dwAttributes = GetFileAttributesW(szFullName); dwAttributes = GetFileAttributesW(szFullName);
if (dwAttributes == INVALID_FILE_ATTRIBUTES) if (dwAttributes == INVALID_FILE_ATTRIBUTES)
{
CoTaskMemFree(szFullName);
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
}
if (dwBufferLength < 2 || szFullName[1] != ':') if (dwBufferLength < 2 || szFullName[1] != ':')
{ {
@ -261,8 +264,8 @@ RecycleBin5_RecycleBin5_DeleteFile(
FileSize.u.LowPart = GetFileSize(s->hInfo, &FileSize.u.HighPart); FileSize.u.LowPart = GetFileSize(s->hInfo, &FileSize.u.HighPart);
if (FileSize.u.LowPart < sizeof(INFO2_HEADER)) if (FileSize.u.LowPart < sizeof(INFO2_HEADER))
{ {
UnmapViewOfFile(pHeader); hr = HRESULT_FROM_WIN32(GetLastError());
return HRESULT_FROM_WIN32(GetLastError()); goto cleanup;
} }
dwEntries = (DWORD)((FileSize.QuadPart - sizeof(INFO2_HEADER)) / sizeof(DELETED_FILE_RECORD)) - 1; dwEntries = (DWORD)((FileSize.QuadPart - sizeof(INFO2_HEADER)) / sizeof(DELETED_FILE_RECORD)) - 1;
pDeletedFile = ((PDELETED_FILE_RECORD)(pHeader + 1)) + dwEntries; pDeletedFile = ((PDELETED_FILE_RECORD)(pHeader + 1)) + dwEntries;