Alexandre Julliard : ntdll: Use malloc() to allocate temporary system information.

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


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

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

ntdll: Use malloc() to allocate temporary system information.

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

---

 dlls/ntdll/unix/system.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 835cf8d134..c705f5a8d1 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2073,7 +2073,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
         char *buffer = NULL;
         unsigned int pos = 0;
 
-        if (size && !(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size )))
+        if (size && !(buffer = malloc( size )))
         {
             ret = STATUS_NO_MEMORY;
             break;
@@ -2090,7 +2090,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
 
         if (ret)
         {
-            RtlFreeHeap( GetProcessHeap(), 0, buffer );
+            free( buffer );
             break;
         }
 
@@ -2166,7 +2166,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
         }
 
         if (len > size) ret = STATUS_INFO_LENGTH_MISMATCH;
-        RtlFreeHeap( GetProcessHeap(), 0, buffer );
+        free( buffer );
         break;
     }
 
@@ -2327,8 +2327,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
         }
 
         num_handles = (size - FIELD_OFFSET( SYSTEM_HANDLE_INFORMATION, Handle )) / sizeof(SYSTEM_HANDLE_ENTRY);
-        if (!(handle_info = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*handle_info) * num_handles )))
-            return STATUS_NO_MEMORY;
+        if (!(handle_info = malloc( sizeof(*handle_info) * num_handles ))) return STATUS_NO_MEMORY;
 
         SERVER_START_REQ( get_system_handles )
         {
@@ -2355,7 +2354,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
         }
         SERVER_END_REQ;
 
-        RtlFreeHeap( GetProcessHeap(), 0, handle_info );
+        free( handle_info );
         break;
     }
 




More information about the wine-cvs mailing list