Check the buffer allocation result before using it.

Signed-off-by:ydong10
Reviewed-by:jljusten


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11811 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-06-13 01:44:03 +00:00
parent bf276b45b8
commit cd8462ea9d
1 changed files with 2 additions and 0 deletions

View File

@ -56,6 +56,7 @@ FindHiiHandleViaDevPath(
Status = HiiDb->ListPackageLists(HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleBuffer = AllocateZeroPool(HandleBufferSize);
ASSERT (HandleBuffer != NULL);
Status = HiiDb->ListPackageLists(HiiDb, EFI_HII_PACKAGE_DEVICE_PATH, NULL, &HandleBufferSize, HandleBuffer);
}
if (EFI_ERROR(Status)) {
@ -69,6 +70,7 @@ FindHiiHandleViaDevPath(
Status = HiiDb->ExportPackageLists(HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
MainBuffer = AllocateZeroPool(MainBufferSize);
ASSERT (MainBuffer != NULL);
Status = HiiDb->ExportPackageLists(HiiDb, HandleBuffer[LoopVariable], &MainBufferSize, MainBuffer);
}
//