Commit d638df9f authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

kernel32: Fix possible leak of directory handle in RemoveDirectoryW.

parent ad83e2cd
...@@ -1655,13 +1655,19 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path ) ...@@ -1655,13 +1655,19 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io, status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (status == STATUS_SUCCESS) if (status != STATUS_SUCCESS)
status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); {
RtlFreeUnicodeString( &nt_name ); 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) if (status != STATUS_SUCCESS)
{ {
SetLastError( RtlNtStatusToDosError(status) ); SetLastError( RtlNtStatusToDosError(status) );
NtClose( handle );
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment