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>
This commit is contained in:
parent
e719fcb5e1
commit
ae9026ddfa
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
HII Library implementation that uses DXE protocols and services.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -465,10 +465,19 @@ HiiGetFormSetFromHiiHandle(
|
|||||||
|
|
||||||
if (FormSetBuffer != NULL){
|
if (FormSetBuffer != NULL){
|
||||||
TempBuffer = AllocateCopyPool (TempSize + ((EFI_IFR_OP_HEADER *) OpCodeData)->Length, FormSetBuffer);
|
TempBuffer = AllocateCopyPool (TempSize + ((EFI_IFR_OP_HEADER *) OpCodeData)->Length, FormSetBuffer);
|
||||||
CopyMem (TempBuffer + TempSize, OpCodeData, ((EFI_IFR_OP_HEADER *) OpCodeData)->Length);
|
|
||||||
FreePool(FormSetBuffer);
|
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 {
|
} else {
|
||||||
TempBuffer = AllocateCopyPool (TempSize + ((EFI_IFR_OP_HEADER *) OpCodeData)->Length, OpCodeData);
|
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;
|
TempSize += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
|
||||||
FormSetBuffer = TempBuffer;
|
FormSetBuffer = TempBuffer;
|
||||||
@ -480,6 +489,7 @@ HiiGetFormSetFromHiiHandle(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Done:
|
||||||
FreePool (HiiPackageList);
|
FreePool (HiiPackageList);
|
||||||
|
|
||||||
*BufferSize = TempSize;
|
*BufferSize = TempSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user