diff options
author | Bi, Dandan <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Bi, Dandan08b> | 2016-07-05 11:19:22 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-06 16:22:52 +0800 |
commit | ae9026ddfa063f23ba3c7c57e3d5d6c9e0de8220 (patch) | |
tree | 8bfa85b1c8ec57fc42d838b8f59c985673a2b016 /MdeModulePkg/Library | |
parent | e719fcb5e172837b0df2ebdb4f0f74d96b5244e7 (diff) | |
download | edk2-ae9026ddfa063f23ba3c7c57e3d5d6c9e0de8220.zip edk2-ae9026ddfa063f23ba3c7c57e3d5d6c9e0de8220.tar.gz edk2-ae9026ddfa063f23ba3c7c57e3d5d6c9e0de8220.tar.bz2 |
MdeModulePkg/UefiHiiLib: Add error handling codes when AllocatePool fail
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r-- | MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index 74ccd02..afd9985 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -1,7 +1,7 @@ /** @file
HII Library implementation that uses DXE protocols and services.
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -465,10 +465,19 @@ HiiGetFormSetFromHiiHandle( if (FormSetBuffer != NULL){
TempBuffer = AllocateCopyPool (TempSize + ((EFI_IFR_OP_HEADER *) OpCodeData)->Length, FormSetBuffer);
- CopyMem (TempBuffer + TempSize, OpCodeData, ((EFI_IFR_OP_HEADER *) OpCodeData)->Length);
FreePool(FormSetBuffer);
+ FormSetBuffer = NULL;
+ if (TempBuffer == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ CopyMem (TempBuffer + TempSize, OpCodeData, ((EFI_IFR_OP_HEADER *) OpCodeData)->Length);
} else {
TempBuffer = AllocateCopyPool (TempSize + ((EFI_IFR_OP_HEADER *) OpCodeData)->Length, OpCodeData);
+ if (TempBuffer == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
}
TempSize += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
FormSetBuffer = TempBuffer;
@@ -480,6 +489,7 @@ HiiGetFormSetFromHiiHandle( break;
}
}
+Done:
FreePool (HiiPackageList);
*BufferSize = TempSize;
|