Commit 9d7b6b65 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

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

parent 09a7e2d3
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment