server: Avoid leaking file descriptor on error in create_thread function.
This commit is contained in:
parent
3d3c92782a
commit
0e2e9e4efc
|
@ -219,11 +219,16 @@ struct thread *create_thread( int fd, struct process *process )
|
|||
|
||||
if (process->is_terminating)
|
||||
{
|
||||
close( fd );
|
||||
set_error( STATUS_PROCESS_IS_TERMINATING );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(thread = alloc_object( &thread_ops ))) return NULL;
|
||||
if (!(thread = alloc_object( &thread_ops )))
|
||||
{
|
||||
close( fd );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
init_thread_structure( thread );
|
||||
|
||||
|
@ -236,6 +241,7 @@ struct thread *create_thread( int fd, struct process *process )
|
|||
|
||||
if (!(thread->id = alloc_ptid( thread )))
|
||||
{
|
||||
close( fd );
|
||||
release_object( thread );
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue