aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/os_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils/os_utils.cpp')
-rw-r--r--src/lib/utils/os_utils.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp
index 71f4f12d4..aa599e4b0 100644
--- a/src/lib/utils/os_utils.cpp
+++ b/src/lib/utils/os_utils.cpp
@@ -383,14 +383,12 @@ std::vector<void*> OS::allocate_locked_pages(size_t count)
}
#endif
- if(ptr != nullptr)
- {
- // Make guard page following the data page
- page_prohibit_access(static_cast<uint8_t*>(ptr) + page_size);
+ std::memset(ptr, 0, 2*page_size); // zero both data and guard pages
- std::memset(ptr, 0, page_size);
- result.push_back(ptr);
- }
+ // Make guard page following the data page
+ page_prohibit_access(static_cast<uint8_t*>(ptr) + page_size);
+
+ result.push_back(ptr);
}
return result;