Alexandre Julliard : ntdll: Use malloc() to allocate the buffer in server_get_unix_name().

Alexandre Julliard julliard at winehq.org
Tue Jul 14 16:23:37 CDT 2020


Module: wine
Branch: master
Commit: 9ec5be2cea3af2ca631ef0dce3208965058abb59
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9ec5be2cea3af2ca631ef0dce3208965058abb59

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul 14 10:32:55 2020 +0200

ntdll: Use malloc() to allocate the buffer in server_get_unix_name().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/file.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 51a7c9b5d1..0b9ad4bc22 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1777,8 +1777,7 @@ static NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name )
 
     for (;;)
     {
-        name = RtlAllocateHeap( GetProcessHeap(), 0, size + 1 );
-        if (!name) return STATUS_NO_MEMORY;
+        if (!(name = malloc( size + 1 ))) return STATUS_NO_MEMORY;
 
         SERVER_START_REQ( get_handle_unix_name )
         {
@@ -1795,7 +1794,7 @@ static NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name )
             *unix_name = name;
             break;
         }
-        RtlFreeHeap( GetProcessHeap(), 0, name );
+        free( name );
         if (ret != STATUS_BUFFER_OVERFLOW) break;
     }
     return ret;
@@ -1962,7 +1961,7 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
     if ((status = server_get_unix_name( handle, &unix_name ))) return status;
 
     letter = find_dos_device( unix_name );
-    RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+    free( unix_name );
 
     if (letter == -1)
     {
@@ -3985,7 +3984,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
                 info->AlignmentInformation.AlignmentRequirement = 1;  /* FIXME */
 
                 io->u.Status = fill_name_info( unix_name, &info->NameInformation, &name_len );
-                RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+                free( unix_name );
                 io->Information = FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName) + name_len;
             }
         }
@@ -4037,7 +4036,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
             {
                 LONG name_len = len - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName);
                 io->u.Status = fill_name_info( unix_name, info, &name_len );
-                RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+                free( unix_name );
                 io->Information = FIELD_OFFSET(FILE_NAME_INFORMATION, FileName) + name_len;
             }
         }
@@ -4072,7 +4071,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
                     info->EndOfFile      = std.EndOfFile;
                     info->FileAttributes = basic.FileAttributes;
                 }
-                RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+                free( unix_name );
             }
         }
         break;
@@ -6395,7 +6394,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
                 if (used_len) *used_len = sizeof(*p) + size;
                 free( nt_name );
             }
-            RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+            free( unix_name );
             break;
         }
         else if (status != STATUS_OBJECT_TYPE_MISMATCH) break;




More information about the wine-cvs mailing list