msi: Free the handle table on PROCESS_DETACH.

This commit is contained in:
Mike McCormack 2006-08-29 17:08:01 +09:00 committed by Alexandre Julliard
parent ada5daa76a
commit 155a325f96
3 changed files with 12 additions and 3 deletions

View File

@ -60,6 +60,13 @@ typedef struct msi_handle_info_t
static msi_handle_info *msihandletable = NULL; static msi_handle_info *msihandletable = NULL;
static int msihandletable_size = 0; static int msihandletable_size = 0;
void msi_free_handle_table(void)
{
msi_free( msihandletable );
msihandletable = NULL;
msihandletable_size = 0;
}
MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
{ {
MSIHANDLE ret = 0; MSIHANDLE ret = 0;
@ -80,12 +87,12 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
newsize = 256; newsize = 256;
p = msi_alloc_zero(newsize*sizeof(msi_handle_info)); p = msi_alloc_zero(newsize*sizeof(msi_handle_info));
} }
else else
{ {
newsize = msihandletable_size * 2; newsize = msihandletable_size * 2;
p = msi_realloc_zero(msihandletable, p = msi_realloc_zero(msihandletable,
newsize*sizeof(msi_handle_info)); newsize*sizeof(msi_handle_info));
} }
if (!p) if (!p)
goto out; goto out;
msihandletable = p; msihandletable = p;

View File

@ -72,6 +72,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
msi_dialog_unregister_class(); msi_dialog_unregister_class();
msi_free_handle_table();
break; break;
} }
return TRUE; return TRUE;

View File

@ -306,6 +306,7 @@ extern void msiobj_addref(MSIOBJECTHDR *);
extern int msiobj_release(MSIOBJECTHDR *); extern int msiobj_release(MSIOBJECTHDR *);
extern void msiobj_lock(MSIOBJECTHDR *); extern void msiobj_lock(MSIOBJECTHDR *);
extern void msiobj_unlock(MSIOBJECTHDR *); extern void msiobj_unlock(MSIOBJECTHDR *);
extern void msi_free_handle_table(void);
extern void free_cached_tables( MSIDATABASE *db ); extern void free_cached_tables( MSIDATABASE *db );
extern void msi_free_transforms( MSIDATABASE *db ); extern void msi_free_transforms( MSIDATABASE *db );