kernel32: Fix memory leak in CopyFileW.

This commit is contained in:
Lionel Debroux 2007-08-30 10:28:20 +02:00 committed by Alexandre Julliard
parent 43860b7a6e
commit 79326157f9
1 changed files with 3 additions and 0 deletions

View File

@ -879,12 +879,14 @@ BOOL WINAPI CopyFileW( LPCWSTR source, LPCWSTR dest, BOOL fail_if_exists )
NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE)
{
WARN("Unable to open source %s\n", debugstr_w(source));
HeapFree( GetProcessHeap(), 0, buffer );
return FALSE;
}
if (!GetFileInformationByHandle( h1, &info ))
{
WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source));
HeapFree( GetProcessHeap(), 0, buffer );
CloseHandle( h1 );
return FALSE;
}
@ -894,6 +896,7 @@ BOOL WINAPI CopyFileW( LPCWSTR source, LPCWSTR dest, BOOL fail_if_exists )
info.dwFileAttributes, h1 )) == INVALID_HANDLE_VALUE)
{
WARN("Unable to open dest %s\n", debugstr_w(dest));
HeapFree( GetProcessHeap(), 0, buffer );
CloseHandle( h1 );
return FALSE;
}