Module: wine Branch: master Commit: d638df9f3e31c08623fa653f837abc754c0d2e44 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d638df9f3e31c08623fa653f83...
Author: Sebastian Lackner sebastian@fds-team.de Date: Tue May 3 03:22:24 2016 +0200
kernel32: Fix possible leak of directory handle in RemoveDirectoryW.
Signed-off-by: Sebastian Lackner sebastian@fds-team.de Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/path.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index b3fccb2..620401d 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -1655,13 +1655,19 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path ) status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); - if (status == STATUS_SUCCESS) - status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); - RtlFreeUnicodeString( &nt_name ); + if (status != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + RtlFreeUnicodeString( &nt_name ); + return FALSE; + }
+ status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); + RtlFreeUnicodeString( &nt_name ); if (status != STATUS_SUCCESS) { SetLastError( RtlNtStatusToDosError(status) ); + NtClose( handle ); return FALSE; }