aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Neumann <tneumann@users.sourceforge.net>2023-05-02 16:21:09 +0200
committerThomas Neumann <tneumann@users.sourceforge.net>2023-06-03 09:45:43 +0200
commit5cf60b6ba111f4169305c7832b063b000e9ec36a (patch)
tree4ae5b9dbd54c843210de7474541806b30fb87dea
parentf5c82bff5ef2930583eccc008cf73653720987b5 (diff)
release the sorted FDE array when deregistering a frame [PR109685]
The atomic fastpath bypasses the code that releases the sort array which was lazily allocated during unwinding. We now check after deregistering if there is an array to free. libgcc/ChangeLog: PR libgcc/109685 * unwind-dw2-fde.c: Free sort array in atomic fast path.
-rw-r--r--libgcc/unwind-dw2-fde.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c
index a5786bf729c..32b9e64a1c8 100644
--- a/libgcc/unwind-dw2-fde.c
+++ b/libgcc/unwind-dw2-fde.c
@@ -241,6 +241,12 @@ __deregister_frame_info_bases (const void *begin)
// And remove
ob = btree_remove (&registered_frames, range[0]);
bool empty_table = (range[1] - range[0]) == 0;
+
+ // Deallocate the sort array if any.
+ if (ob && ob->s.b.sorted)
+ {
+ free (ob->u.sort);
+ }
#else
init_object_mutex_once ();
__gthread_mutex_lock (&object_mutex);