summaryrefslogtreecommitdiff
path: root/allocate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'allocate.cpp')
-rw-r--r--allocate.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/allocate.cpp b/allocate.cpp
index b5be7fab..4ed052f0 100644
--- a/allocate.cpp
+++ b/allocate.cpp
@@ -71,14 +71,20 @@ void * AlignedAllocate(size_t size)
void AlignedDeallocate(void *p)
{
+ // Guard pointer due to crash on AIX when CRYPTOPP_NO_ALIGNED_ALLOC
+ // is in effect. The guard was previously in place in SecBlock,
+ // but it was removed at f4d68353ca7c as part of GH #875.
+ if (p != NULLPTR)
+ {
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
- _mm_free(p);
+ _mm_free(p);
#elif defined(CRYPTOPP_NO_ALIGNED_ALLOC)
- p = (byte *)p - ((byte *)p)[-1];
- free(p);
+ p = (byte *)p - ((byte *)p)[-1];
+ free(p);
#else
- free(p);
+ free(p);
#endif
+ }
}
void * UnalignedAllocate(size_t size)