mirror of https://github.com/openssl/openssl.git
crypto/mem.c: set *freeptr on posix_memalign failure
Initialise *freeptr when posix_memalign fails, so the free(freeptr) idiom can be used unconditionally in all cases by the callers. Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
This commit is contained in:
parent
4bf0b8af2f
commit
ac9a52716c
|
@ -256,7 +256,7 @@ void *CRYPTO_aligned_alloc(size_t num, size_t alignment, void **freeptr,
|
|||
if (malloc_impl == CRYPTO_malloc) {
|
||||
#if defined(_BSD_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
|
||||
if (posix_memalign(&ret, alignment, num))
|
||||
return NULL;
|
||||
ret = NULL;
|
||||
*freeptr = ret;
|
||||
return ret;
|
||||
#elif defined(_ISOC11_SOURCE)
|
||||
|
|
Loading…
Reference in New Issue