diff options
Diffstat (limited to 'src/alloc')
-rw-r--r-- | src/alloc/alloc_mmap/mmap_mem.cpp | 6 | ||||
-rw-r--r-- | src/alloc/secmem.h | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/alloc/alloc_mmap/mmap_mem.cpp b/src/alloc/alloc_mmap/mmap_mem.cpp index e4b602764..17c189e9b 100644 --- a/src/alloc/alloc_mmap/mmap_mem.cpp +++ b/src/alloc/alloc_mmap/mmap_mem.cpp @@ -128,15 +128,17 @@ void MemoryMapping_Allocator::dealloc_block(void* ptr, size_t n) const byte PATTERNS[] = { 0x00, 0xF5, 0x5A, 0xAF, 0x00 }; + // The char* casts are for Solaris, args are void* on most other systems + for(size_t i = 0; i != sizeof(PATTERNS); ++i) { std::memset(ptr, PATTERNS[i], n); - if(::msync((char*)ptr, n, MS_SYNC)) + if(::msync(static_cast<char*>(ptr), n, MS_SYNC)) throw MemoryMapping_Failed("Sync operation failed"); } - if(::munmap((char*)ptr, n)) + if(::munmap(static_cast<char*>(ptr), n)) throw MemoryMapping_Failed("Could not unmap file"); } diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h index 2552343d6..884f2ebc0 100644 --- a/src/alloc/secmem.h +++ b/src/alloc/secmem.h @@ -172,11 +172,12 @@ class MemoryRegion * Copy constructor * @param other the other region to copy */ - MemoryRegion(const MemoryRegion<T>& other) + MemoryRegion(const MemoryRegion<T>& other) : + buf(0), + used(0), + allocated(0), + alloc(other.alloc) { - buf = 0; - used = allocated = 0; - alloc = other.alloc; resize(other.size()); copy(&other[0], other.size()); } |