summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_end.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdw/dwarf_end.c')
-rw-r--r--libdw/dwarf_end.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 7e194a55..77f537a7 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -100,17 +100,19 @@ dwarf_end (Dwarf *dwarf)
tdestroy (dwarf->split_tree, noop_free);
/* Free the internally allocated memory. */
- struct libdw_memblock *memp;
- memp = (struct libdw_memblock *) (atomic_load_explicit
- (&dwarf->mem_tail,
- memory_order_relaxed));
- while (memp != NULL)
- {
- struct libdw_memblock *prevp = memp->prev;
- free (memp);
- memp = prevp;
- }
- pthread_key_delete (dwarf->mem_key);
+ for (size_t i = 0; i < dwarf->mem_stacks; i++)
+ {
+ struct libdw_memblock *memp = dwarf->mem_tails[i];
+ while (memp != NULL)
+ {
+ struct libdw_memblock *prevp = memp->prev;
+ free (memp);
+ memp = prevp;
+ }
+ }
+ if (dwarf->mem_tails != NULL)
+ free (dwarf->mem_tails);
+ pthread_rwlock_destroy (&dwarf->mem_rwl);
/* Free the pubnames helper structure. */
free (dwarf->pubnames_sets);