Fix after "dwarf: do not allocate in load_debug_frame (#72)".
This patch also adds munmap() for unw_debug_frame_list elements.
@@ -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
