diff options
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsHelper.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsHelper.c b/ArmPkg/Library/BdsLib/BdsHelper.c index d971a76b71..bd1fa005e8 100644 --- a/ArmPkg/Library/BdsLib/BdsHelper.c +++ b/ArmPkg/Library/BdsLib/BdsHelper.c @@ -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; } |