Commit 0e2e9e4e authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

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

parent 3d3c9278
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment