diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index d5f845b568..98176555af 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -502,7 +502,15 @@ InternalAlignedAlloc ( ) { #ifndef _WIN32 - return aligned_alloc (Alignment, Size); + int Result; + void *Buffer; + + Result = posix_memalign (&Buffer, Alignment, Size); + if (Result != 0) { + return NULL; + } + + return Buffer; #else return _aligned_malloc (Size, Alignment); #endif