libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH] Fix unwind cache flush


From: Sergey Korolev
Subject: [Libunwind-devel] [PATCH] Fix unwind cache flush
Date: Sun, 17 Jun 2018 21:26:09 +0300

Fix after "dwarf: do not allocate in load_debug_frame (#72)".
This patch also adds munmap() for unw_debug_frame_list elements.
---
 src/mi/flush_cache.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/mi/flush_cache.c b/src/mi/flush_cache.c
index cbd93e1a..9a344c0d 100644
--- a/src/mi/flush_cache.c
+++ b/src/mi/flush_cache.c
@@ -30,21 +30,24 @@ unw_flush_cache (unw_addr_space_t as, unw_word_t lo, unw_word_t hi)
 {
 #if !UNW_TARGET_IA64
   struct unw_debug_frame_list *w = as->debug_frames;
-#endif
 
-  /* clear dyn_info_list_addr cache: */
-  as->dyn_info_list_addr = 0;
-
-#if !UNW_TARGET_IA64
-  for (; w; w = w->next)
+  while (w)
     {
+      struct unw_debug_frame_list *n = w->next;
+
       if (w->index)
         free (w->index);
-      free (w->debug_frame);
+
+      munmap (w->debug_frame, w->debug_frame_size);
+      munmap (w, sizeof (*w));
+      w = n;
     }
   as->debug_frames = NULL;
 #endif
 
+  /* clear dyn_info_list_addr cache: */
+  as->dyn_info_list_addr = 0;
+
   /* This lets us flush caches lazily.  The implementation currently
      ignores the flush range arguments (lo-hi).  This is OK because
      unw_flush_cache() is allowed to flush more than the requested
-- 
2.11.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]