server: Always free the process handle table even if the process didn't start.
This commit is contained in:
parent
3557b9818c
commit
350c0caba0
|
@ -171,6 +171,15 @@ static void handle_table_destroy( struct object *obj )
|
||||||
free( table->entries );
|
free( table->entries );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* close all the process handles and free the handle table */
|
||||||
|
void close_process_handles( struct process *process )
|
||||||
|
{
|
||||||
|
struct handle_table *table = process->handles;
|
||||||
|
|
||||||
|
process->handles = NULL;
|
||||||
|
if (table) release_object( table );
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate a new handle table */
|
/* allocate a new handle table */
|
||||||
struct handle_table *alloc_handle_table( struct process *process, int count )
|
struct handle_table *alloc_handle_table( struct process *process, int count )
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@ extern obj_handle_t open_object( const struct namespace *namespace, const struct
|
||||||
extern obj_handle_t find_inherited_handle( struct process *process, const struct object_ops *ops );
|
extern obj_handle_t find_inherited_handle( struct process *process, const struct object_ops *ops );
|
||||||
extern obj_handle_t enumerate_handles( struct process *process, const struct object_ops *ops,
|
extern obj_handle_t enumerate_handles( struct process *process, const struct object_ops *ops,
|
||||||
unsigned int *index );
|
unsigned int *index );
|
||||||
|
extern void close_process_handles( struct process *process );
|
||||||
extern struct handle_table *alloc_handle_table( struct process *process, int count );
|
extern struct handle_table *alloc_handle_table( struct process *process, int count );
|
||||||
extern struct handle_table *copy_handle_table( struct process *process, struct process *parent );
|
extern struct handle_table *copy_handle_table( struct process *process, struct process *parent );
|
||||||
extern unsigned int get_handle_table_count( struct process *process);
|
extern unsigned int get_handle_table_count( struct process *process);
|
||||||
|
|
|
@ -416,6 +416,7 @@ static void process_destroy( struct object *obj )
|
||||||
|
|
||||||
assert( !process->sigkill_timeout ); /* timeout should hold a reference to the process */
|
assert( !process->sigkill_timeout ); /* timeout should hold a reference to the process */
|
||||||
|
|
||||||
|
close_process_handles( process );
|
||||||
set_process_startup_state( process, STARTUP_ABORTED );
|
set_process_startup_state( process, STARTUP_ABORTED );
|
||||||
if (process->console) release_object( process->console );
|
if (process->console) release_object( process->console );
|
||||||
if (process->parent) release_object( process->parent );
|
if (process->parent) release_object( process->parent );
|
||||||
|
@ -615,15 +616,12 @@ void kill_console_processes( struct thread *renderer, int exit_code )
|
||||||
/* a process has been killed (i.e. its last thread died) */
|
/* a process has been killed (i.e. its last thread died) */
|
||||||
static void process_killed( struct process *process )
|
static void process_killed( struct process *process )
|
||||||
{
|
{
|
||||||
struct handle_table *handles;
|
|
||||||
struct list *ptr;
|
struct list *ptr;
|
||||||
|
|
||||||
assert( list_empty( &process->thread_list ));
|
assert( list_empty( &process->thread_list ));
|
||||||
process->end_time = current_time;
|
process->end_time = current_time;
|
||||||
if (!process->is_system) close_process_desktop( process );
|
if (!process->is_system) close_process_desktop( process );
|
||||||
handles = process->handles;
|
close_process_handles( process );
|
||||||
process->handles = NULL;
|
|
||||||
if (handles) release_object( handles );
|
|
||||||
process->winstation = 0;
|
process->winstation = 0;
|
||||||
process->desktop = 0;
|
process->desktop = 0;
|
||||||
if (process->idle_event)
|
if (process->idle_event)
|
||||||
|
|
Loading…
Reference in New Issue