ntdll: Use malloc() to allocate the object attributes buffer.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-03 12:04:02 +02:00
parent 72fc2ceaa6
commit a07cff77d3
4 changed files with 17 additions and 18 deletions

View File

@ -3596,7 +3596,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
RtlFreeAnsiString( &unix_name );
}
else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
@ -3671,7 +3671,7 @@ NTSTATUS WINAPI NtCreateMailslotFile( HANDLE *handle, ULONG access, OBJECT_ATTRI
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return status;
}
@ -3719,7 +3719,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( HANDLE *handle, ULONG access, OBJECT_ATTR
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return status;
}

View File

@ -836,7 +836,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
if (socketpair( PF_UNIX, SOCK_STREAM, 0, socketfd ) == -1)
{
status = STATUS_TOO_MANY_OPENED_FILES;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
goto done;
}
#ifdef SO_PASSCRED
@ -873,7 +873,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
process_info = wine_server_ptr_handle( reply->info );
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
if (status)
{
@ -906,7 +906,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
}
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
if (status) goto done;
/* create the child process */

View File

@ -263,8 +263,7 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
len = (len + 3) & ~3; /* DWORD-align the entire structure */
*ret = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
if (!*ret) return STATUS_NO_MEMORY;
if (!(*ret = calloc( len, 1 ))) return STATUS_NO_MEMORY;
(*ret)->rootdir = wine_server_obj_handle( attr->RootDirectory );
(*ret)->attributes = attr->Attributes;
@ -341,7 +340,7 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}
@ -448,7 +447,7 @@ NTSTATUS WINAPI NtCreateEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}
@ -601,7 +600,7 @@ NTSTATUS WINAPI NtCreateMutant( HANDLE *handle, ACCESS_MASK access, const OBJECT
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}
@ -702,7 +701,7 @@ NTSTATUS WINAPI NtCreateJobObject( HANDLE *handle, ACCESS_MASK access, const OBJ
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}
@ -937,7 +936,7 @@ NTSTATUS WINAPI NtCreateTimer( HANDLE *handle, ACCESS_MASK access, const OBJECT_
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}
@ -1280,7 +1279,7 @@ NTSTATUS WINAPI NtCreateKeyedEvent( HANDLE *handle, ACCESS_MASK access,
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}
@ -1370,7 +1369,7 @@ NTSTATUS WINAPI NtCreateIoCompletion( HANDLE *handle, ACCESS_MASK access, OBJECT
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return status;
}
@ -1583,7 +1582,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return ret;
}

View File

@ -193,7 +193,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
if (server_pipe( request_pipe ) == -1)
{
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
return STATUS_TOO_MANY_OPENED_FILES;
}
server_send_fd( request_pipe[0] );
@ -216,7 +216,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
}
SERVER_END_REQ;
RtlFreeHeap( GetProcessHeap(), 0, objattr );
free( objattr );
if (status)
{
close( request_pipe[1] );