forked from OSchip/llvm-project
Fix a use-after-unmap bug in /proc/self/maps caching. The cached buffer was occasionally deleted in the MemoryMappingLayout destructor.
llvm-svn: 169335
This commit is contained in:
parent
a8f026e2d4
commit
0a4e0f6d35
|
@ -236,7 +236,11 @@ MemoryMappingLayout::MemoryMappingLayout() {
|
|||
}
|
||||
|
||||
MemoryMappingLayout::~MemoryMappingLayout() {
|
||||
UnmapOrDie(proc_self_maps_.data, proc_self_maps_.mmaped_size);
|
||||
// Only unmap the buffer if it is different from the cached one. Otherwise
|
||||
// it will be unmapped when the cache is refreshed.
|
||||
if (proc_self_maps_.data != cached_proc_self_maps_.data) {
|
||||
UnmapOrDie(proc_self_maps_.data, proc_self_maps_.mmaped_size);
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryMappingLayout::Reset() {
|
||||
|
|
Loading…
Reference in New Issue