diff options
author | Florian Mayer <fmayer@google.com> | 2019-02-27 18:00:37 +0000 |
---|---|---|
committer | Florian Mayer <fmayer@google.com> | 2019-03-05 13:05:36 +0000 |
commit | 3d67d347f5322ca6d4aeac790368bff1f50e27b1 (patch) | |
tree | 7f7972210500803c11055447dbe592fd6db236ee /libbacktrace/UnwindStackMap.cpp | |
parent | d5345f58fdb11f9f362b00bbfd9d7b19ca659fcc (diff) |
Fix copy / move behaviour of Maps object.
Currently, moving or copying a Maps object leads to double free of MapInfo.
Even moving a Maps object did not prevent this, as after a move
the object only has to be in an "unspecified but valid state", which can
be the original state for a vector of raw pointers (but not for a vector
of unique_ptrs).
Changing to unique_ptrs is the most failsafe way to make sure we never
accidentally destruct MapInfo.
Test: atest libuwindstack_test
Failed LocalUnwinderTest#unwind_after_dlopen which also fails at master.
Change-Id: Id1c9739b334da5c1ba532fd55366e115940a66d3
Diffstat (limited to 'libbacktrace/UnwindStackMap.cpp')
-rw-r--r-- | libbacktrace/UnwindStackMap.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp index 9d15af2db..4518891c3 100644 --- a/libbacktrace/UnwindStackMap.cpp +++ b/libbacktrace/UnwindStackMap.cpp @@ -55,7 +55,7 @@ bool UnwindStackMap::Build() { } // Iterate through the maps and fill in the backtrace_map_t structure. - for (auto* map_info : *stack_maps_) { + for (const auto& map_info : *stack_maps_) { backtrace_map_t map; map.start = map_info->start; map.end = map_info->end; |