]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
MdeModulePkg/BootMaintUi: Add error handling codes when AllocatePool fail
[mirror_edk2.git] / MdeModulePkg / Library / BootMaintenanceManagerUiLib / BootOption.c
index 0bd3170872c799c84da9342410cf97fedd6af3f2..890728aff5b69cfc2867b12633ceeed25c1178eb 100644 (file)
@@ -857,6 +857,7 @@ GetDriverOrder (
   @retval FALSE  Not exit caller function.\r
 **/\r
 BOOLEAN \r
+EFIAPI\r
 BootFromFile (\r
   IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
   )\r
@@ -864,29 +865,33 @@ BootFromFile (
   EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
   CHAR16                       *FileName;\r
 \r
+  FileName = NULL;\r
+\r
   FileName = ExtractFileNameFromDevicePath(FilePath);\r
-  EfiBootManagerInitializeLoadOption (\r
-    &BootOption,\r
-    0,\r
-    LoadOptionTypeBoot,\r
-    LOAD_OPTION_ACTIVE,\r
-    FileName,\r
-    FilePath,\r
-    NULL,\r
-    0\r
-    );\r
-  //\r
-  // Since current no boot from removable media directly is allowed */\r
-  //\r
-  gST->ConOut->ClearScreen (gST->ConOut);\r
+  if (FileName != NULL) {\r
+    EfiBootManagerInitializeLoadOption (\r
+      &BootOption,\r
+      0,\r
+      LoadOptionTypeBoot,\r
+      LOAD_OPTION_ACTIVE,\r
+      FileName,\r
+      FilePath,\r
+      NULL,\r
+      0\r
+      );\r
+    //\r
+    // Since current no boot from removable media directly is allowed */\r
+    //\r
+    gST->ConOut->ClearScreen (gST->ConOut);\r
 \r
-  BmmBdsSetConsoleMode (FALSE);\r
-  EfiBootManagerBoot (&BootOption);\r
-  BmmBdsSetConsoleMode (TRUE);\r
+    BmmSetConsoleMode (FALSE);\r
+    EfiBootManagerBoot (&BootOption);\r
+    BmmSetConsoleMode (TRUE);\r
 \r
-  FreePool(FileName);\r
+    FreePool(FileName);\r
 \r
-  EfiBootManagerFreeLoadOption (&BootOption);\r
+    EfiBootManagerFreeLoadOption (&BootOption);\r
+  }\r
 \r
   return FALSE;\r
 }\r
@@ -929,6 +934,7 @@ ReSendForm(
   @retval FALSE  Not exit caller function.\r
 **/\r
 BOOLEAN \r
+EFIAPI\r
 CreateBootOptionFromFile (\r
   IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
   )\r
@@ -946,6 +952,7 @@ CreateBootOptionFromFile (
 \r
 **/\r
 BOOLEAN \r
+EFIAPI\r
 CreateDriverOptionFromFile (\r
   IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
   )\r