diff options
author | Jack Lloyd <[email protected]> | 2019-03-07 10:35:06 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-03-07 10:35:06 -0500 |
commit | 9252df39094fc06106c340838411b1c753983199 (patch) | |
tree | f3ae224743bf2d28813a5565d232744a8380d0ca /src/lib/utils/os_utils.cpp | |
parent | 841c9cf1f30c6528a63ec238a585f0381627fece (diff) |
Fix Coverity warnings
Checking a ptr against null after dereferencing it.
Allowing exception throw to escape a noexcept function.
Both harmless.
Diffstat (limited to 'src/lib/utils/os_utils.cpp')
-rw-r--r-- | src/lib/utils/os_utils.cpp | 12 |
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; |