From 79326157f9ab0caf85cf70a4a9d7ac8c83cbcced Mon Sep 17 00:00:00 2001 From: Lionel Debroux Date: Thu, 30 Aug 2007 10:28:20 +0200 Subject: [PATCH] kernel32: Fix memory leak in CopyFileW. --- dlls/kernel32/path.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index eb752f0c32..7932df06b5 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -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; }