BaseTools: Checked return value of malloc for EfiCompress.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17775 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Yingke Liu 2015-07-01 05:16:46 +00:00 committed by yingke
parent b40286bbec
commit a1fe73a1c7
1 changed files with 7 additions and 0 deletions

View File

@ -408,6 +408,9 @@ Returns:
UINT32 i; UINT32 i;
mText = malloc (WNDSIZ * 2 + MAXMATCH); mText = malloc (WNDSIZ * 2 + MAXMATCH);
if (mText == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (i = 0 ; i < WNDSIZ * 2 + MAXMATCH; i ++) { for (i = 0 ; i < WNDSIZ * 2 + MAXMATCH; i ++) {
mText[i] = 0; mText[i] = 0;
} }
@ -418,6 +421,10 @@ Returns:
mParent = malloc (WNDSIZ * 2 * sizeof(*mParent)); mParent = malloc (WNDSIZ * 2 * sizeof(*mParent));
mPrev = malloc (WNDSIZ * 2 * sizeof(*mPrev)); mPrev = malloc (WNDSIZ * 2 * sizeof(*mPrev));
mNext = malloc ((MAX_HASH_VAL + 1) * sizeof(*mNext)); mNext = malloc ((MAX_HASH_VAL + 1) * sizeof(*mNext));
if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||
mParent == NULL || mPrev == NULL || mNext == NULL) {
return EFI_OUT_OF_RESOURCES;
}
mBufSiz = 16 * 1024U; mBufSiz = 16 * 1024U;
while ((mBuf = malloc(mBufSiz)) == NULL) { while ((mBuf = malloc(mBufSiz)) == NULL) {