diff options
author | Dave Watson <davejwatson@fb.com> | 2018-06-20 10:38:42 -0700 |
---|---|---|
committer | Dave Watson <davejwatson@fb.com> | 2018-06-20 10:38:42 -0700 |
commit | d32956507cf29d9b1a98a8bce53c78623908f4fe (patch) | |
tree | eec5fda29b8377c98399eb5ce8c2371a73230b52 | |
parent | 2991e70f09af3e0297994ce5024e814aae72a659 (diff) | |
download | libunwind-d32956507cf29d9b1a98a8bce53c78623908f4fe.tar.gz |
Fix after "dwarf: do not allocate in load_debug_frame (#72)".
This patch also adds munmap() for unw_debug_frame_list elements.
-rw-r--r-- | src/mi/flush_cache.c | 17 |
1 files 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 |