ntdll: Use malloc() to allocate temporary process data.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-14 10:33:57 +02:00
parent 83f9e784e4
commit 42a2ad202e
1 changed files with 4 additions and 4 deletions

View File

@ -233,7 +233,7 @@ static startup_info_t *create_startup_info( const RTL_USER_PROCESS_PARAMETERS *p
size = (size + 1) & ~1; size = (size + 1) & ~1;
*info_size = size; *info_size = size;
if (!(info = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, size ))) return NULL; if (!(info = calloc( size, 1 ))) return NULL;
info->debug_flags = params->DebugFlags; info->debug_flags = params->DebugFlags;
info->console_flags = params->ConsoleFlags; info->console_flags = params->ConsoleFlags;
@ -461,7 +461,7 @@ static ULONG get_env_size( const RTL_USER_PROCESS_PARAMETERS *params, char **win
if (!*winedebug && !wcsncmp( ptr, WINEDEBUG, ARRAY_SIZE( WINEDEBUG ) - 1 )) if (!*winedebug && !wcsncmp( ptr, WINEDEBUG, ARRAY_SIZE( WINEDEBUG ) - 1 ))
{ {
DWORD len = wcslen(ptr) * 3 + 1; DWORD len = wcslen(ptr) * 3 + 1;
if ((*winedebug = RtlAllocateHeap( GetProcessHeap(), 0, len ))) if ((*winedebug = malloc( len )))
ntdll_wcstoumbs( ptr, wcslen(ptr) + 1, *winedebug, len, FALSE ); ntdll_wcstoumbs( ptr, wcslen(ptr) + 1, *winedebug, len, FALSE );
} }
ptr += wcslen(ptr) + 1; ptr += wcslen(ptr) + 1;
@ -991,8 +991,8 @@ done:
if (thread_handle) NtClose( thread_handle ); if (thread_handle) NtClose( thread_handle );
if (socketfd[0] != -1) close( socketfd[0] ); if (socketfd[0] != -1) close( socketfd[0] );
if (unixdir != -1) close( unixdir ); if (unixdir != -1) close( unixdir );
RtlFreeHeap( GetProcessHeap(), 0, startup_info ); free( startup_info );
RtlFreeHeap( GetProcessHeap(), 0, winedebug ); free( winedebug );
return status; return status;
} }