aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-06-26 23:11:03 +0000
committerlloyd <[email protected]>2012-06-26 23:11:03 +0000
commite6fc8070ab1b4144b5ebad9e9e594173d562f59c (patch)
tree071bb844217b9c188934fe3bfc688206fee191dd /src/alloc
parent0b817481d04aa9585c056d10ab55d2f2df42816d (diff)
Set poolsize to zero on failure. Set m_pool to null if mmap fails
Diffstat (limited to 'src/alloc')
-rw-r--r--src/alloc/locking_allocator/locking_allocator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/alloc/locking_allocator/locking_allocator.cpp b/src/alloc/locking_allocator/locking_allocator.cpp
index 6cdfc3e8e..575a5f962 100644
--- a/src/alloc/locking_allocator/locking_allocator.cpp
+++ b/src/alloc/locking_allocator/locking_allocator.cpp
@@ -225,7 +225,11 @@ mlock_allocator::mlock_allocator() :
-1, 0));
if(m_pool == static_cast<byte*>(MAP_FAILED))
+ {
+ m_pool = nullptr;
+ m_poolsize = 0;
throw std::runtime_error("Failed to mmap locking_allocator pool");
+ }
clear_mem(m_pool, m_poolsize);
@@ -233,6 +237,7 @@ 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");
}
@@ -248,6 +253,7 @@ mlock_allocator::~mlock_allocator()
::munlock(m_pool, m_poolsize);
::munmap(m_pool, m_poolsize);
m_pool = nullptr;
+ m_poolsize = 0;
}
}