Lionel Debroux : kernel32: Fix memory leak in CopyFileW.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 30 13:50:22 CDT 2007


Module: wine
Branch: master
Commit: 79326157f9ab0caf85cf70a4a9d7ac8c83cbcced
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=79326157f9ab0caf85cf70a4a9d7ac8c83cbcced

Author: Lionel Debroux <lionel_debroux at yahoo.fr>
Date:   Thu Aug 30 10:28:20 2007 +0200

kernel32: Fix memory leak in CopyFileW.

---

 dlls/kernel32/path.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index eb752f0..7932df0 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;
     }




More information about the wine-cvs mailing list