ArmPkg/BdsLib: Fixed ShutdownUefiBootServices() in case the first gBS->GetMemoryMap() was successful

If the first call of gBS->GetMemoryMap() succeeded (could happen if the Memory Map
has changed between the two gBS->GetMemoryMap() calls) in the loop block then
gBS->ExitBootServices() was never called.

Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13500 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2012-07-04 20:21:13 +00:00
parent 8cfd2e2457
commit 7422411e38
1 changed files with 11 additions and 9 deletions

View File

@ -43,6 +43,7 @@ ShutdownUefiBootServices (
MemoryMap = NULL;
MemoryMapSize = 0;
Pages = 0;
do {
Status = gBS->GetMemoryMap (
&MemoryMapSize,
@ -66,17 +67,18 @@ ShutdownUefiBootServices (
&DescriptorSize,
&DescriptorVersion
);
// Don't do anything between the GetMemoryMap() and ExitBootServices()
if (!EFI_ERROR (Status)) {
Status = gBS->ExitBootServices (gImageHandle, MapKey);
if (EFI_ERROR (Status)) {
FreePages (MemoryMap, Pages);
MemoryMap = NULL;
MemoryMapSize = 0;
}
}
// Don't do anything between the GetMemoryMap() and ExitBootServices()
if (!EFI_ERROR(Status)) {
Status = gBS->ExitBootServices (gImageHandle, MapKey);
if (EFI_ERROR(Status)) {
FreePages (MemoryMap, Pages);
MemoryMap = NULL;
MemoryMapSize = 0;
}
}
} while (EFI_ERROR (Status));
} while (EFI_ERROR(Status));
return Status;
}