about summary refs log tree commit diff homepage
path: root/include/klee/KDAlloc/mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/klee/KDAlloc/mapping.h')
-rw-r--r--include/klee/KDAlloc/mapping.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/klee/KDAlloc/mapping.h b/include/klee/KDAlloc/mapping.h
index f566a211..c66e2f4b 100644
--- a/include/klee/KDAlloc/mapping.h
+++ b/include/klee/KDAlloc/mapping.h
@@ -54,6 +54,10 @@ class Mapping {
 
     auto mappedAddress = ::mmap(reinterpret_cast<void *>(baseAddress), size,
                                 PROT_READ | PROT_WRITE, flags, -1, 0);
+    if (mappedAddress == MAP_FAILED) {
+      this->baseAddress = MAP_FAILED;
+      return false;
+    }
     if (baseAddress != 0 &&
         baseAddress != reinterpret_cast<std::uintptr_t>(mappedAddress)) {
       [[maybe_unused]] int rc = ::munmap(mappedAddress, size);
@@ -61,10 +65,6 @@ class Mapping {
       this->baseAddress = MAP_FAILED;
       return false;
     }
-    if (mappedAddress == MAP_FAILED) {
-      this->baseAddress = MAP_FAILED;
-      return false;
-    }
     this->baseAddress = mappedAddress;
 
 #if defined(__linux__)
@@ -98,10 +98,6 @@ public:
 
   Mapping(std::uintptr_t baseAddress, std::size_t size) noexcept : size(size) {
     try_map(baseAddress);
-    assert(*this && "failed to allocate mapping");
-    if (!*this) {
-      std::abort();
-    }
   }
 
   Mapping(Mapping const &) = delete;