diff options
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/mem_ops.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/utils/mem_ops.cpp b/src/lib/utils/mem_ops.cpp index 460fc4b69..9ef1d6c4e 100644 --- a/src/lib/utils/mem_ops.cpp +++ b/src/lib/utils/mem_ops.cpp @@ -17,6 +17,9 @@ namespace Botan { BOTAN_MALLOC_FN void* allocate_memory(size_t elems, size_t elem_size) { + if(elems == 0 || elem_size == 0) + return nullptr; + #if defined(BOTAN_HAS_LOCKING_ALLOCATOR) if(void* p = mlock_allocator::instance().allocate(elems, elem_size)) return p; |