From 155a325f967d2d222baec5bab7eaad95ad5f3967 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 29 Aug 2006 17:08:01 +0900 Subject: [PATCH] msi: Free the handle table on PROCESS_DETACH. --- dlls/msi/handle.c | 13 ++++++++++--- dlls/msi/msi_main.c | 1 + dlls/msi/msipriv.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/msi/handle.c b/dlls/msi/handle.c index 3bcdb46f3f4..0193277c875 100644 --- a/dlls/msi/handle.c +++ b/dlls/msi/handle.c @@ -60,6 +60,13 @@ typedef struct msi_handle_info_t static msi_handle_info *msihandletable = NULL; 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 ret = 0; @@ -80,12 +87,12 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) newsize = 256; p = msi_alloc_zero(newsize*sizeof(msi_handle_info)); } - else - { + else + { newsize = msihandletable_size * 2; p = msi_realloc_zero(msihandletable, newsize*sizeof(msi_handle_info)); - } + } if (!p) goto out; msihandletable = p; diff --git a/dlls/msi/msi_main.c b/dlls/msi/msi_main.c index fcb6f5d450d..294de714dd8 100644 --- a/dlls/msi/msi_main.c +++ b/dlls/msi/msi_main.c @@ -72,6 +72,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) break; case DLL_PROCESS_DETACH: msi_dialog_unregister_class(); + msi_free_handle_table(); break; } return TRUE; diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 6f771dae9b0..991c11cb1fa 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -306,6 +306,7 @@ extern void msiobj_addref(MSIOBJECTHDR *); extern int msiobj_release(MSIOBJECTHDR *); extern void msiobj_lock(MSIOBJECTHDR *); extern void msiobj_unlock(MSIOBJECTHDR *); +extern void msi_free_handle_table(void); extern void free_cached_tables( MSIDATABASE *db ); extern void msi_free_transforms( MSIDATABASE *db );