diff options
Diffstat (limited to 'lib/common/Guards.h')
-rw-r--r-- | lib/common/Guards.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/common/Guards.h b/lib/common/Guards.h index 7ca1fbb6..364252a5 100644 --- a/lib/common/Guards.h +++ b/lib/common/Guards.h @@ -77,7 +77,16 @@ class MemoryBlockGuard { public: MemoryBlockGuard(int BlockSize) - : mpBlock(::malloc(BlockSize)) + : mpBlock(::malloc(BlockSize)) + { + if(mpBlock == 0) + { + throw std::bad_alloc(); + } + } + + MemoryBlockGuard(void *pBlock) + : mpBlock(pBlock) { if(mpBlock == 0) { |