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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-14 10:35:27 +02:00
parent 242dc8989a
commit 20bc32cddc
1 changed files with 5 additions and 6 deletions

View File

@ -2073,7 +2073,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
char *buffer = NULL; char *buffer = NULL;
unsigned int pos = 0; unsigned int pos = 0;
if (size && !(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size ))) if (size && !(buffer = malloc( size )))
{ {
ret = STATUS_NO_MEMORY; ret = STATUS_NO_MEMORY;
break; break;
@ -2090,7 +2090,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
if (ret) if (ret)
{ {
RtlFreeHeap( GetProcessHeap(), 0, buffer ); free( buffer );
break; break;
} }
@ -2166,7 +2166,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
} }
if (len > size) ret = STATUS_INFO_LENGTH_MISMATCH; if (len > size) ret = STATUS_INFO_LENGTH_MISMATCH;
RtlFreeHeap( GetProcessHeap(), 0, buffer ); free( buffer );
break; 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); num_handles = (size - FIELD_OFFSET( SYSTEM_HANDLE_INFORMATION, Handle )) / sizeof(SYSTEM_HANDLE_ENTRY);
if (!(handle_info = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*handle_info) * num_handles ))) if (!(handle_info = malloc( sizeof(*handle_info) * num_handles ))) return STATUS_NO_MEMORY;
return STATUS_NO_MEMORY;
SERVER_START_REQ( get_system_handles ) SERVER_START_REQ( get_system_handles )
{ {
@ -2355,7 +2354,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
} }
SERVER_END_REQ; SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, handle_info ); free( handle_info );
break; break;
} }