summaryrefslogtreecommitdiff
path: root/secblock.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-09-27 12:00:08 -0400
committerJeffrey Walton <noloader@gmail.com>2019-09-27 12:00:08 -0400
commitf4d68353ca7cb28975f70dc95ffff20afc8e5e63 (patch)
tree09cac2e604c409c17f75111ecef6b615c135910a /secblock.h
parentb444c02886dc4d6588e42caedaac070837f2781f (diff)
downloadcryptopp-git-f4d68353ca7cb28975f70dc95ffff20afc8e5e63.tar.gz
Use AlignedDeallocate if T_Align16 in deallocate (GH #875)
This should match the behavior of allocate
Diffstat (limited to 'secblock.h')
-rw-r--r--secblock.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/secblock.h b/secblock.h
index 813106d2..2d9ea21e 100644
--- a/secblock.h
+++ b/secblock.h
@@ -187,12 +187,11 @@ public:
/// \returns a memory block
/// \throws InvalidArgument
/// \details allocate() first checks the size of the request. If it is non-0
- /// and less than max_size(), then an attempt is made to fulfill the request using either
- /// AlignedAllocate() or UnalignedAllocate().
- /// \details AlignedAllocate() is used if T_Align16 is true.
- /// UnalignedAllocate() used if T_Align16 is false.
- /// \details This is the C++ *Placement New* operator. ptr is not used, and the function
- /// CRYPTOPP_ASSERTs in Debug builds if ptr is non-NULL.
+ /// and less than max_size(), then an attempt is made to fulfill the request
+ /// using either AlignedAllocate() or UnalignedAllocate(). AlignedAllocate() is
+ /// used if T_Align16 is true. UnalignedAllocate() used if T_Align16 is false.
+ /// \details This is the C++ *Placement New* operator. ptr is not used, and the
+ /// function asserts in Debug builds if ptr is non-NULL.
/// \sa CallNewHandler() for the methods used to recover from a failed
/// allocation attempt.
/// \note size is the count of elements, and not the number of bytes
@@ -215,9 +214,9 @@ public:
/// \brief Deallocates a block of memory
/// \param ptr the pointer for the allocation
/// \param size the size of the allocation, in elements
- /// \details Internally, SecureWipeArray() is called before deallocating the memory.
- /// Once the memory block is wiped or zeroized, AlignedDeallocate() or
- /// UnalignedDeallocate() is called.
+ /// \details Internally, SecureWipeArray() is called before deallocating the
+ /// memory. Once the memory block is wiped or zeroized, AlignedDeallocate()
+ /// or UnalignedDeallocate() is called.
/// \details AlignedDeallocate() is used if T_Align16 is true.
/// UnalignedDeallocate() used if T_Align16 is false.
void deallocate(void *ptr, size_type size)
@@ -228,7 +227,7 @@ public:
SecureWipeArray(reinterpret_cast<pointer>(ptr), size);
#if CRYPTOPP_BOOL_ALIGN16
- if (T_Align16 && size)
+ if (T_Align16)
return AlignedDeallocate(ptr);
#endif