From 2edb12e249387a72b24f5f34efae4735d589af9f Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 29 Sep 2017 19:15:48 -0400 Subject: In secure_allocator, hide mlock/new usage in a function in mem_ops Switch to calloc/free instead of new/delete - shouldn't matter since we are only allocate integral types. This change reduces the size of libbotan-2.so by ~300 Kb on my system. --- src/lib/utils/locking_allocator/locking_allocator.cpp | 2 +- src/lib/utils/locking_allocator/locking_allocator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/utils/locking_allocator') diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp index 880f3add8..f36fa9130 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.cpp +++ b/src/lib/utils/locking_allocator/locking_allocator.cpp @@ -116,7 +116,7 @@ void* mlock_allocator::allocate(size_t num_elems, size_t elem_size) return nullptr; } -bool mlock_allocator::deallocate(void* p, size_t num_elems, size_t elem_size) +bool mlock_allocator::deallocate(void* p, size_t num_elems, size_t elem_size) BOTAN_NOEXCEPT { if(!m_pool) return false; diff --git a/src/lib/utils/locking_allocator/locking_allocator.h b/src/lib/utils/locking_allocator/locking_allocator.h index 8e38129e2..e9299c120 100644 --- a/src/lib/utils/locking_allocator/locking_allocator.h +++ b/src/lib/utils/locking_allocator/locking_allocator.h @@ -21,7 +21,7 @@ class BOTAN_PUBLIC_API(2,0) mlock_allocator final void* allocate(size_t num_elems, size_t elem_size); - bool deallocate(void* p, size_t num_elems, size_t elem_size); + bool deallocate(void* p, size_t num_elems, size_t elem_size) BOTAN_NOEXCEPT; mlock_allocator(const mlock_allocator&) = delete; -- cgit v1.2.3