Fix srcfiles deallocation
This commit is contained in:
parent
bc0164224e
commit
4ab78f7a69
@ -206,7 +206,13 @@ namespace libdwarf {
|
|||||||
dwarf_srclines_dealloc_b(entry.second.line_context);
|
dwarf_srclines_dealloc_b(entry.second.line_context);
|
||||||
}
|
}
|
||||||
for(auto& entry : srcfiles_cache) {
|
for(auto& entry : srcfiles_cache) {
|
||||||
dwarf_dealloc(dbg, entry.second.first, DW_DLA_LIST);
|
auto srcfiles = entry.second.first;
|
||||||
|
auto count = entry.second.second;
|
||||||
|
for(int i = 0; i < count; i++) {
|
||||||
|
dwarf_dealloc(dbg, srcfiles[i], DW_DLA_STRING);
|
||||||
|
srcfiles[i] = nullptr;
|
||||||
|
}
|
||||||
|
dwarf_dealloc(dbg, srcfiles, DW_DLA_LIST);
|
||||||
}
|
}
|
||||||
// subprograms_cache needs to be destroyed before dbg otherwise there will be another use after free
|
// subprograms_cache needs to be destroyed before dbg otherwise there will be another use after free
|
||||||
subprograms_cache.clear();
|
subprograms_cache.clear();
|
||||||
@ -352,6 +358,10 @@ namespace libdwarf {
|
|||||||
// dwarf is using 1-indexing
|
// dwarf is using 1-indexing
|
||||||
filename = dw_srcfiles[file_i];
|
filename = dw_srcfiles[file_i];
|
||||||
}
|
}
|
||||||
|
for(int i = 0; i < dw_filecount; i++) {
|
||||||
|
dwarf_dealloc(cu_die.dbg, dw_srcfiles[i], DW_DLA_STRING);
|
||||||
|
dw_srcfiles[i] = nullptr;
|
||||||
|
}
|
||||||
dwarf_dealloc(cu_die.dbg, dw_srcfiles, DW_DLA_LIST);
|
dwarf_dealloc(cu_die.dbg, dw_srcfiles, DW_DLA_LIST);
|
||||||
} else {
|
} else {
|
||||||
auto off = cu_die.get_global_offset();
|
auto off = cu_die.get_global_offset();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user