/** @file\r
Legacy Boot Maintainence UI implementation.\r
\r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
@param EnBootOptionCount Count of the enabled Boot Option Numbers\r
@param DisBootOption Callee allocated buffer containing the disabled Boot Option Numbers\r
@param DisBootOptionCount Count of the disabled Boot Option Numbers\r
+\r
+ @return EFI_SUCCESS The function completed successfully.\r
+ @retval other Contain some error, details see the status return by gRT->SetVariable.\r
**/\r
-VOID\r
+EFI_STATUS\r
OrderLegacyBootOption4SameType (\r
UINT16 *DevOrder,\r
UINTN DevOrderCount,\r
*DisBootOptionCount = 0;\r
*EnBootOptionCount = 0;\r
Index = 0;\r
+ Status = EFI_SUCCESS;\r
\r
ASSERT (BbsIndexArray != NULL);\r
ASSERT (DeviceTypeArray != NULL);\r
BootOrderSize,\r
BootOrder\r
);\r
- ASSERT_EFI_ERROR (Status);\r
\r
FreePool (NewBootOption);\r
FreePool (DeviceTypeArray);\r
FreePool (BbsIndexArray);\r
+\r
+ return Status;\r
}\r
\r
/**\r
@param NVMapData The data for egacy BBS boot.\r
\r
@return EFI_SUCCESS The function completed successfully.\r
- @retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can be found.\r
+ @retval EFI_NOT_FOUND If L"LegacyDevOrder" and gEfiLegacyDevOrderVariableGuid EFI Variable can not be found.\r
@retval EFI_OUT_OF_RESOURCES Fail to allocate memory resource\r
+ @retval other Contain some error, details see the status return by gRT->SetVariable.\r
**/\r
EFI_STATUS\r
UpdateBBSOption (\r
DisMap = NULL;\r
NewOrder = NULL;\r
CurrentType = 0;\r
+ EnBootOption = NULL;\r
+ DisBootOption = NULL;\r
\r
\r
DisMap = mLegacyBootOptionPrivate->MaintainMapData->DisableMap;\r
//\r
ASSERT (OptionMenu->MenuNumber == DevOrder->Length / sizeof (UINT16) - 1);\r
\r
- OrderLegacyBootOption4SameType (\r
+ Status = OrderLegacyBootOption4SameType (\r
DevOrder->Data,\r
DevOrder->Length / sizeof (UINT16) - 1,\r
&EnBootOption,\r
&DisBootOption,\r
&DisBootOptionCount\r
);\r
+ if (EFI_ERROR(Status)) {\r
+ goto Fail;\r
+ }\r
\r
//\r
// 2. Deactivate the DisBootOption and activate the EnBootOption\r
OriginalPtr\r
);\r
\r
+Fail:\r
+ if (EnBootOption != NULL) {\r
+ FreePool (EnBootOption);\r
+ }\r
+\r
+ if (DisBootOption != NULL) {\r
+ FreePool (DisBootOption);\r
+ }\r
+\r
FreePool (OriginalPtr);\r
return Status;\r
}\r