Eric Pouech : dbghelp: Added helper to free module's specific data (ELF, MSC...) upon removal.

Alexandre Julliard julliard at winehq.org
Tue Mar 16 11:49:21 CDT 2010


Module: wine
Branch: master
Commit: 9d7b6b65ef2e748d771c7e381c0316ac6564850e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9d7b6b65ef2e748d771c7e381c0316ac6564850e

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Mon Mar 15 21:12:31 2010 +0100

dbghelp: Added helper to free module's specific data (ELF, MSC...) upon removal.

---

 dlls/dbghelp/dbghelp_private.h |    1 +
 dlls/dbghelp/elf_module.c      |    6 ++++++
 dlls/dbghelp/module.c          |    3 +++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index e7e3c7c..24c9cfb 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -326,6 +326,7 @@ struct module
     /* specific information for debug types */
     struct elf_module_info*	elf_info;
     struct dwarf2_module_info_s*dwarf2_info;
+    void                        (*module_remove)(struct process* pcs, struct module* module);
 
     struct macho_module_info*	macho_info;
 
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 6a8a151..11399b4 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -358,6 +358,11 @@ static void elf_unmap_file(struct elf_file_map* fmap)
     }
 }
 
+static void elf_module_remove(struct process* pcs, struct module* module)
+{
+    HeapFree(GetProcessHeap(), 0, module->elf_info);
+}
+
 /******************************************************************
  *		elf_is_in_thunk_area
  *
@@ -1132,6 +1137,7 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR* filename,
         elf_info->module = module_new(pcs, filename, DMT_ELF, FALSE,
                                       (load_offset) ? load_offset : fmap.elf_start,
                                       fmap.elf_size, 0, calc_crc32(fmap.fd));
+        elf_info->module->module_remove = elf_module_remove;
         if (!elf_info->module)
         {
             HeapFree(GetProcessHeap(), 0, elf_module_info);
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 53f56c2..cbb5c40 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -168,6 +168,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
 
     module->type              = type;
     module->is_virtual        = virtual ? TRUE : FALSE;
+    module->module_remove     = NULL;
     module->sortlist_valid    = FALSE;
     module->sorttab_size      = 0;
     module->addr_sorttab      = NULL;
@@ -624,6 +625,8 @@ BOOL module_remove(struct process* pcs, struct module* module)
     struct module**     p;
 
     TRACE("%s (%p)\n", debugstr_w(module->module.ModuleName), module);
+
+    if (module->module_remove) module->module_remove(pcs, module);
     hash_table_destroy(&module->ht_symbols);
     hash_table_destroy(&module->ht_types);
     HeapFree(GetProcessHeap(), 0, module->sources);




More information about the wine-cvs mailing list