diff options
author | Yingke Liu <yingke.d.liu@intel.com> | 2015-07-01 05:16:46 +0000 |
---|---|---|
committer | yingke <yingke@Edk2> | 2015-07-01 05:16:46 +0000 |
commit | a1fe73a1c799547208e7c2218f1c99578cc41683 (patch) | |
tree | 3b86f217f16867457872a47f1bf54c7416573dc8 /BaseTools/Source/C/Common | |
parent | b40286bbec147233d7ca2daa5c25ed19a7dc5e43 (diff) | |
download | edk2-platforms-a1fe73a1c799547208e7c2218f1c99578cc41683.tar.xz |
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
Diffstat (limited to 'BaseTools/Source/C/Common')
-rw-r--r-- | BaseTools/Source/C/Common/EfiCompress.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/BaseTools/Source/C/Common/EfiCompress.c b/BaseTools/Source/C/Common/EfiCompress.c index bd86d1276a..b225fee913 100644 --- a/BaseTools/Source/C/Common/EfiCompress.c +++ b/BaseTools/Source/C/Common/EfiCompress.c @@ -408,6 +408,9 @@ Returns: UINT32 i;
mText = malloc (WNDSIZ * 2 + MAXMATCH);
+ if (mText == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
for (i = 0 ; i < WNDSIZ * 2 + MAXMATCH; i ++) {
mText[i] = 0;
}
@@ -418,6 +421,10 @@ Returns: mParent = malloc (WNDSIZ * 2 * sizeof(*mParent));
mPrev = malloc (WNDSIZ * 2 * sizeof(*mPrev));
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;
while ((mBuf = malloc(mBufSiz)) == NULL) {
|