diff options
author | Jeffrey Walton <noloader@gmail.com> | 2019-10-13 23:55:01 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2019-10-13 23:55:01 -0400 |
commit | 55b5464e50602ff4958eb27ec58e79263da4283b (patch) | |
tree | 1120322c48ecd4d2fd79f6851d12ef9375549931 /allocate.cpp | |
parent | 891b8db04a3a7f64050c3293c7b4e9f5b98f627c (diff) | |
download | cryptopp-git-55b5464e50602ff4958eb27ec58e79263da4283b.tar.gz |
Fix AIX crash in AlignedDeallocate (GH #875)
Diffstat (limited to 'allocate.cpp')
-rw-r--r-- | allocate.cpp | 14 |
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)
|