/** @file\r
+Elf convert solution\r
\r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available \r
under the terms and conditions of the BSD License which accompanies this \r
#include <string.h>\r
#include <time.h>\r
#include <ctype.h>\r
+#include <assert.h>\r
\r
#include <Common/UefiBaseTypes.h>\r
#include <IndustryStandard/PeImage.h>\r
\r
mCoffFile = realloc (\r
mCoffFile,\r
- mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000\r
+ mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2 * MAX_COFF_ALIGNMENT\r
);\r
+ if (mCoffFile == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ }\r
+ assert (mCoffFile != NULL);\r
memset (\r
mCoffFile + mCoffOffset, 0,\r
- sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000\r
+ sizeof(EFI_IMAGE_BASE_RELOCATION) + 2 * MAX_COFF_ALIGNMENT\r
);\r
\r
mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset);\r