server: Always free the process handle table even if the process didn't start.

This commit is contained in:
Alexandre Julliard 2010-08-24 12:10:51 +02:00
parent 3557b9818c
commit 350c0caba0
3 changed files with 12 additions and 4 deletions

View File

@ -171,6 +171,15 @@ static void handle_table_destroy( struct object *obj )
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 */
struct handle_table *alloc_handle_table( struct process *process, int count )
{

View File

@ -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 enumerate_handles( struct process *process, const struct object_ops *ops,
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 *copy_handle_table( struct process *process, struct process *parent );
extern unsigned int get_handle_table_count( struct process *process);

View File

@ -416,6 +416,7 @@ static void process_destroy( struct object *obj )
assert( !process->sigkill_timeout ); /* timeout should hold a reference to the process */
close_process_handles( process );
set_process_startup_state( process, STARTUP_ABORTED );
if (process->console) release_object( process->console );
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) */
static void process_killed( struct process *process )
{
struct handle_table *handles;
struct list *ptr;
assert( list_empty( &process->thread_list ));
process->end_time = current_time;
if (!process->is_system) close_process_desktop( process );
handles = process->handles;
process->handles = NULL;
if (handles) release_object( handles );
close_process_handles( process );
process->winstation = 0;
process->desktop = 0;
if (process->idle_event)