diff options
-rw-r--r-- | src/alloc/locking_allocator/locking_allocator.cpp | 7 | ||||
-rw-r--r-- | src/alloc/locking_allocator/locking_allocator.h | 3 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/alloc/locking_allocator/locking_allocator.cpp b/src/alloc/locking_allocator/locking_allocator.cpp index 575a5f962..d1a1b9c72 100644 --- a/src/alloc/locking_allocator/locking_allocator.cpp +++ b/src/alloc/locking_allocator/locking_allocator.cpp @@ -45,8 +45,8 @@ size_t mlock_limit() bool ptr_in_pool(const void* pool_ptr, size_t poolsize, const void* buf_ptr, size_t bufsize) { - const size_t pool = reinterpret_cast<size_t>(pool_ptr); - const size_t buf = reinterpret_cast<size_t>(buf_ptr); + const uintptr_t pool = reinterpret_cast<uintptr_t>(pool_ptr); + const uintptr_t buf = reinterpret_cast<uintptr_t>(buf_ptr); if(buf < pool || buf >= pool + poolsize) return false; @@ -227,7 +227,6 @@ mlock_allocator::mlock_allocator() : if(m_pool == static_cast<byte*>(MAP_FAILED)) { m_pool = nullptr; - m_poolsize = 0; throw std::runtime_error("Failed to mmap locking_allocator pool"); } @@ -237,7 +236,6 @@ mlock_allocator::mlock_allocator() : { ::munmap(m_pool, m_poolsize); m_pool = nullptr; - m_poolsize = 0; throw std::runtime_error("Failed to lock pool in memory"); } @@ -253,7 +251,6 @@ mlock_allocator::~mlock_allocator() ::munlock(m_pool, m_poolsize); ::munmap(m_pool, m_poolsize); m_pool = nullptr; - m_poolsize = 0; } } diff --git a/src/alloc/locking_allocator/locking_allocator.h b/src/alloc/locking_allocator/locking_allocator.h index 4b5e25e03..3bebea5f2 100644 --- a/src/alloc/locking_allocator/locking_allocator.h +++ b/src/alloc/locking_allocator/locking_allocator.h @@ -32,8 +32,9 @@ class BOTAN_DLL mlock_allocator ~mlock_allocator(); + const size_t m_poolsize; + std::mutex m_mutex; - size_t m_poolsize; std::vector<std::pair<size_t, size_t>> m_freelist; byte* m_pool; }; |