server: Avoid leaking file descriptor on error in create_thread function.

This commit is contained in:
Sebastian Lackner 2014-11-17 19:23:13 +01:00 committed by Alexandre Julliard
parent 3d3c92782a
commit 0e2e9e4efc
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}