1. Use MemoryAllocationLib to replace boot services memory services functions in EdkModulePkg.

2. Added NULL pointer check before calling FreePool () to fix bugs when free memory.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2513 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2007-03-29 06:58:38 +00:00
parent cb360b2656
commit c8dd259d61
13 changed files with 357 additions and 394 deletions

View File

@ -1,18 +1,18 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
ConPlatform.c ConPlatform.c
Abstract: Abstract:
--*/ --*/
@ -47,7 +47,7 @@ ConPlatformTextInDriverBindingSupported (
/*++ /*++
Routine Description: Routine Description:
Supported Supported
Arguments: Arguments:
(Standard DriverBinding Protocol Supported() function) (Standard DriverBinding Protocol Supported() function)
@ -76,7 +76,7 @@ ConPlatformTextOutDriverBindingSupported (
/*++ /*++
Routine Description: Routine Description:
Supported Supported
Arguments: Arguments:
(Standard DriverBinding Protocol Supported() function) (Standard DriverBinding Protocol Supported() function)
@ -105,7 +105,7 @@ ConPlatformDriverBindingSupported (
/*++ /*++
Routine Description: Routine Description:
Supported Supported
Arguments: Arguments:
(Standard DriverBinding Protocol Supported() function) (Standard DriverBinding Protocol Supported() function)
@ -551,7 +551,7 @@ Returns:
Caller is repsoncible freeing the buffer. Caller is repsoncible freeing the buffer.
NULL - Variable was not read NULL - Variable was not read
--*/ --*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -576,8 +576,8 @@ Returns:
// //
// Allocate the buffer to return // Allocate the buffer to return
// //
Status = gBS->AllocatePool (EfiBootServicesData, BufferSize, &Buffer); Buffer = AllocatePool (BufferSize);
if (EFI_ERROR (Status)) { if (Buffer == NULL) {
return NULL; return NULL;
} }
// //
@ -591,7 +591,7 @@ Returns:
Buffer Buffer
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (Buffer); FreePool (Buffer);
Buffer = NULL; Buffer = NULL;
} }
} }
@ -616,18 +616,18 @@ Arguments:
Multi - A pointer to a multi-instance device path data structure. Multi - A pointer to a multi-instance device path data structure.
Single - A pointer to a single-instance device path data structure. Single - A pointer to a single-instance device path data structure.
NewDevicePath - If Delete is TRUE, this parameter must not be null, and it NewDevicePath - If Delete is TRUE, this parameter must not be null, and it
points to the remaining device path data structure. points to the remaining device path data structure.
(remaining device path = Multi - Single.) (remaining device path = Multi - Single.)
Delete - If TRUE, means removing Single from Multi. Delete - If TRUE, means removing Single from Multi.
If FALSE, the routine just check whether Single matches If FALSE, the routine just check whether Single matches
with any instance in Multi. with any instance in Multi.
Returns: Returns:
The function returns EFI_SUCCESS if the Single is contained within Multi. The function returns EFI_SUCCESS if the Single is contained within Multi.
Otherwise, EFI_NOT_FOUND is returned. Otherwise, EFI_NOT_FOUND is returned.
--*/ --*/
@ -658,7 +658,7 @@ Returns:
while (DevicePathInst) { while (DevicePathInst) {
if (CompareMem (Single, DevicePathInst, Size) == 0) { if (CompareMem (Single, DevicePathInst, Size) == 0) {
if (!Delete) { if (!Delete) {
gBS->FreePool (DevicePathInst); FreePool (DevicePathInst);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} else { } else {
@ -667,12 +667,14 @@ Returns:
TempDevicePath1, TempDevicePath1,
DevicePathInst DevicePathInst
); );
gBS->FreePool (TempDevicePath1); if (TempDevicePath1 != NULL) {
FreePool (TempDevicePath1);
}
TempDevicePath1 = TempDevicePath2; TempDevicePath1 = TempDevicePath2;
} }
} }
gBS->FreePool (DevicePathInst); FreePool (DevicePathInst);
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size); DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
} }
@ -693,7 +695,7 @@ ConPlatformUpdateDeviceVariable (
/*++ /*++
Routine Description: Routine Description:
Arguments: Arguments:
@ -730,7 +732,9 @@ Returns:
// //
// The device path is already in the variable // The device path is already in the variable
// //
gBS->FreePool (VariableDevicePath); if (VariableDevicePath != NULL) {
FreePool (VariableDevicePath);
}
return Status; return Status;
} }
@ -760,7 +764,9 @@ Returns:
); );
} }
gBS->FreePool (VariableDevicePath); if (VariableDevicePath != NULL) {
FreePool (VariableDevicePath);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
@ -774,7 +780,7 @@ Returns:
NewVariableDevicePath NewVariableDevicePath
); );
gBS->FreePool (NewVariableDevicePath); FreePool (NewVariableDevicePath);
return Status; return Status;
} }

View File

@ -46,6 +46,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DevicePathLib</Keyword> <Keyword>DevicePathLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename>ConPlatform.c</Filename> <Filename>ConPlatform.c</Filename>

View File

@ -1,13 +1,13 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
@ -49,7 +49,7 @@ Arguments:
Returns: Returns:
NONE NONE
--*/ --*/
{ {
@ -76,7 +76,7 @@ Returns:
// //
// Free The Old Stack // Free The Old Stack
// //
gBS->FreePool (mBooleanEvaluationStack); FreePool (mBooleanEvaluationStack);
} }
mBooleanEvaluationStack = NewStack; mBooleanEvaluationStack = NewStack;
@ -96,11 +96,11 @@ Routine Description:
Arguments: Arguments:
NONE NONE
Returns: Returns:
NONE NONE
--*/ --*/
{ {
@ -201,7 +201,7 @@ GrowBooleanExpression (
// //
// Free The Old buffer // Free The Old buffer
// //
gBS->FreePool (*BooleanExpression); FreePool (*BooleanExpression);
} else { } else {
// //
// Copy data into new buffer // Copy data into new buffer
@ -484,7 +484,7 @@ Returns:
Width = (*PIterator)->Width; Width = (*PIterator)->Width;
// //
// Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them. // Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them.
// //
if ((*PIterator)->QuestionId1 != INVALID_OFFSET_VALUE && if ((*PIterator)->QuestionId1 != INVALID_OFFSET_VALUE &&
@ -498,7 +498,7 @@ Returns:
MapValue = (UINT8) *MapBuffer; MapValue = (UINT8) *MapBuffer;
} }
gBS->FreePool (MapBuffer); FreePool (MapBuffer);
} }
if (MapBuffer2 != NULL) { if (MapBuffer2 != NULL) {
@ -508,16 +508,16 @@ Returns:
MapValue2 = (UINT8) *MapBuffer2; MapValue2 = (UINT8) *MapBuffer2;
} }
gBS->FreePool (MapBuffer2); FreePool (MapBuffer2);
} }
} }
switch ((*PIterator)->Operand) { switch ((*PIterator)->Operand) {
case EFI_IFR_EQ_VAR_VAL_OP: case EFI_IFR_EQ_VAR_VAL_OP:
UnicodeValueToString ( UnicodeValueToString (
VariableName, VariableName,
FALSE, FALSE,
(UINTN) (*PIterator)->QuestionId1, (UINTN) (*PIterator)->QuestionId1,
(sizeof (VariableName) / sizeof (VariableName[0])) - 1 (sizeof (VariableName) / sizeof (VariableName[0])) - 1
); );
@ -727,7 +727,7 @@ Returns:
return Operator; return Operator;
} }
// //
// Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them. // Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them.
// //
if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE && if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE &&
@ -741,7 +741,7 @@ Returns:
MapValue = (UINT8) *MapBuffer; MapValue = (UINT8) *MapBuffer;
} }
gBS->FreePool (MapBuffer); FreePool (MapBuffer);
} }
if (MapBuffer2 != NULL) { if (MapBuffer2 != NULL) {
@ -751,7 +751,7 @@ Returns:
MapValue2 = (UINT8) *MapBuffer2; MapValue2 = (UINT8) *MapBuffer2;
} }
gBS->FreePool (MapBuffer2); FreePool (MapBuffer2);
} }
} }
@ -814,9 +814,9 @@ Returns:
} }
UnicodeValueToString ( UnicodeValueToString (
VariableName, VariableName,
FALSE, FALSE,
(UINTN) Iterator->QuestionId1, (UINTN) Iterator->QuestionId1,
(sizeof (VariableName) / sizeof (VariableName[0])) - 1 (sizeof (VariableName) / sizeof (VariableName[0])) - 1
); );
@ -913,7 +913,7 @@ Returns:
MapValue = (UINT8) *MapBuffer; MapValue = (UINT8) *MapBuffer;
} }
gBS->FreePool (MapBuffer); FreePool (MapBuffer);
} }
if (MapBuffer2 != NULL) { if (MapBuffer2 != NULL) {
@ -923,7 +923,7 @@ Returns:
MapValue2 = (UINT8) *MapBuffer2; MapValue2 = (UINT8) *MapBuffer2;
} }
gBS->FreePool (MapBuffer2); FreePool (MapBuffer2);
} }
} }
@ -947,9 +947,9 @@ Returns:
// //
case EFI_IFR_EQ_VAR_VAL_OP: case EFI_IFR_EQ_VAR_VAL_OP:
UnicodeValueToString ( UnicodeValueToString (
VariableName, VariableName,
FALSE, FALSE,
(UINTN) Iterator->QuestionId1, (UINTN) Iterator->QuestionId1,
(sizeof (VariableName) / sizeof (VariableName[0])) - 1 (sizeof (VariableName) / sizeof (VariableName[0])) - 1
); );
@ -1049,7 +1049,7 @@ Returns:
MapValue = (UINT8) *MapBuffer; MapValue = (UINT8) *MapBuffer;
} }
gBS->FreePool (MapBuffer); FreePool (MapBuffer);
} }
if (MapBuffer2 != NULL) { if (MapBuffer2 != NULL) {
@ -1059,7 +1059,7 @@ Returns:
MapValue2 = (UINT8) *MapBuffer2; MapValue2 = (UINT8) *MapBuffer2;
} }
gBS->FreePool (MapBuffer2); FreePool (MapBuffer2);
} }
} }
@ -1083,9 +1083,9 @@ Returns:
// //
case EFI_IFR_EQ_VAR_VAL_OP: case EFI_IFR_EQ_VAR_VAL_OP:
UnicodeValueToString ( UnicodeValueToString (
VariableName, VariableName,
FALSE, FALSE,
(UINTN) Iterator->QuestionId1, (UINTN) Iterator->QuestionId1,
(sizeof (VariableName) / sizeof (VariableName[0])) - 1 (sizeof (VariableName) / sizeof (VariableName[0])) - 1
); );
@ -1205,7 +1205,7 @@ Returns:
MapValue = (UINT8) *MapBuffer; MapValue = (UINT8) *MapBuffer;
} }
gBS->FreePool (MapBuffer); FreePool (MapBuffer);
} }
if (MapBuffer2 != NULL) { if (MapBuffer2 != NULL) {
@ -1215,7 +1215,7 @@ Returns:
MapValue2 = (UINT8) *MapBuffer2; MapValue2 = (UINT8) *MapBuffer2;
} }
gBS->FreePool (MapBuffer2); FreePool (MapBuffer2);
} }
} }
@ -1231,9 +1231,9 @@ Returns:
// //
case EFI_IFR_EQ_VAR_VAL_OP: case EFI_IFR_EQ_VAR_VAL_OP:
UnicodeValueToString ( UnicodeValueToString (
VariableName, VariableName,
FALSE, FALSE,
(UINTN) Iterator->QuestionId1, (UINTN) Iterator->QuestionId1,
(sizeof (VariableName) / sizeof (VariableName[0])) - 1 (sizeof (VariableName) / sizeof (VariableName[0])) - 1
); );
@ -1295,7 +1295,7 @@ Returns:
PushBool (&StackPtr, Operator); PushBool (&StackPtr, Operator);
} }
break; break;
case EFI_IFR_TRUE_OP: case EFI_IFR_TRUE_OP:
// //
// To check whether Ifr is legacy. Once every boolean expression. // To check whether Ifr is legacy. Once every boolean expression.

View File

@ -14,7 +14,7 @@ Module Name:
InputHandler.C InputHandler.C
Abstract: Abstract:
Implementation for handling user input from the User Interface Implementation for handling user input from the User Interface
Revision History Revision History
@ -86,7 +86,7 @@ ReadString(
// //
CreatePopUp (ScreenSize, 4, &NullCharacter, PromptForDataString, Space, &NullCharacter); CreatePopUp (ScreenSize, 4, &NullCharacter, PromptForDataString, Space, &NullCharacter);
gBS->FreePool (PromptForDataString); FreePool (PromptForDataString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY)); gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY));
@ -107,8 +107,8 @@ ReadString(
break; break;
case SCAN_ESC: case SCAN_ESC:
gBS->FreePool (TempString); FreePool (TempString);
gBS->FreePool (BufferedString); FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->EnableCursor (gST->ConOut, CursorVisible); gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
@ -122,8 +122,8 @@ ReadString(
case CHAR_CARRIAGE_RETURN: case CHAR_CARRIAGE_RETURN:
if (GetStringWidth (StringPtr) >= MenuOption->ThisTag->Minimum) { if (GetStringWidth (StringPtr) >= MenuOption->ThisTag->Minimum) {
SelectionComplete = TRUE; SelectionComplete = TRUE;
gBS->FreePool (TempString); FreePool (TempString);
gBS->FreePool (BufferedString); FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->EnableCursor (gST->ConOut, CursorVisible); gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
return EFI_SUCCESS; return EFI_SUCCESS;
@ -137,8 +137,8 @@ ReadString(
do { do {
Status = WaitForKeyStroke (&Key); Status = WaitForKeyStroke (&Key);
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
gBS->FreePool (TempString); FreePool (TempString);
gBS->FreePool (BufferedString); FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->EnableCursor (gST->ConOut, CursorVisible); gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
@ -309,7 +309,7 @@ Error:
WidthOfString = GetStringWidth (Packet->String); WidthOfString = GetStringWidth (Packet->String);
ScreenSize = EFI_MAX(WidthOfString, GetStringWidth (gPressEnter)) / 2; ScreenSize = EFI_MAX(WidthOfString, GetStringWidth (gPressEnter)) / 2;
CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter); CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter);
gBS->FreePool (Packet); FreePool (Packet);
do { do {
Status = WaitForKeyStroke (&Key); Status = WaitForKeyStroke (&Key);
@ -422,7 +422,7 @@ Error:
WidthOfString = GetStringWidth (Packet->String); WidthOfString = GetStringWidth (Packet->String);
ScreenSize = EFI_MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2; ScreenSize = EFI_MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2;
CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter); CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter);
gBS->FreePool (Packet); FreePool (Packet);
} }
StringPtr[0] = CHAR_NULL; StringPtr[0] = CHAR_NULL;
@ -571,8 +571,8 @@ Error:
} while (1); } while (1);
Done: Done:
gBS->FreePool (TempString); FreePool (TempString);
gBS->FreePool (TempString2); FreePool (TempString2);
return Status; return Status;
} }
@ -600,7 +600,7 @@ EncodePassword (
CopyMem (Password, Buffer, MaxSize); CopyMem (Password, Buffer, MaxSize);
gBS->FreePool (Buffer); FreePool (Buffer);
return ; return ;
} }
@ -880,7 +880,7 @@ EnterCarriageReturn:
case CHAR_CARRIAGE_RETURN: case CHAR_CARRIAGE_RETURN:
SelectionComplete = TRUE; SelectionComplete = TRUE;
gBS->FreePool (StringPtr); FreePool (StringPtr);
break; break;
default: default:
@ -1083,7 +1083,7 @@ GetSelectionInputPopUp (
PopUpWidth = StrLen (StringPtr); PopUpWidth = StrLen (StringPtr);
} }
gBS->FreePool (StringPtr); FreePool (StringPtr);
} }
} }
// //
@ -1224,7 +1224,7 @@ GetSelectionInputPopUp (
TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1)); TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1));
ASSERT (TempStringPtr != NULL); ASSERT (TempStringPtr != NULL);
CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5))); CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));
gBS->FreePool (StringPtr); FreePool (StringPtr);
StringPtr = TempStringPtr; StringPtr = TempStringPtr;
StrCat (StringPtr, (CHAR16 *) L"..."); StrCat (StringPtr, (CHAR16 *) L"...");
} }
@ -1256,7 +1256,7 @@ GetSelectionInputPopUp (
PrintStringAt (Start + 2, Index2, StringPtr); PrintStringAt (Start + 2, Index2, StringPtr);
} }
gBS->FreePool (StringPtr); FreePool (StringPtr);
Index2 = Index2 + 1; Index2 = Index2 + 1;
} }
} }
@ -1520,7 +1520,7 @@ TheKey:
case SCAN_ESC: case SCAN_ESC:
gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute); gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
if (ValueArrayBackup != NULL) { if (ValueArrayBackup != NULL) {
gBS->FreePool (ValueArrayBackup); FreePool (ValueArrayBackup);
} }
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
@ -1537,7 +1537,7 @@ TheKey:
// //
if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) { if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
CopyMem (ValueArray, ValueArrayBackup, ValueCount); CopyMem (ValueArray, ValueArrayBackup, ValueCount);
gBS->FreePool (ValueArrayBackup); FreePool (ValueArrayBackup);
} else { } else {
*Value = TempValue; *Value = TempValue;
} }

View File

@ -1,12 +1,12 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
Presentation.c Presentation.c
@ -60,7 +60,7 @@ ClearLines (
gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow); gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow);
gBS->FreePool (Buffer); FreePool (Buffer);
return ; return ;
} }
@ -237,7 +237,7 @@ DisplayPageFrame (
break; break;
} }
gBS->FreePool (StrFrontPageBanner); FreePool (StrFrontPageBanner);
} }
} }
} }
@ -318,7 +318,7 @@ DisplayPageFrame (
} }
} }
gBS->FreePool (Buffer); FreePool (Buffer);
} }
@ -327,7 +327,7 @@ DisplayPageFrame (
?F2=Previous Page Setup Page ? ?F2=Previous Page Setup Page ?
+------------------------------------------------------------------------------+ +------------------------------------------------------------------------------+
@ -437,7 +437,7 @@ DisplayForm (
// //
// Remove Buffer allocated for StringPtr after it has been used. // Remove Buffer allocated for StringPtr after it has been used.
// //
gBS->FreePool (StringPtr); FreePool (StringPtr);
for (Index = 0; FormTags.Tags[Index].Operand != EFI_IFR_END_FORM_OP; Index++) { for (Index = 0; FormTags.Tags[Index].Operand != EFI_IFR_END_FORM_OP; Index++) {
GrayOut = FALSE; GrayOut = FALSE;
@ -595,7 +595,7 @@ GetOut:
FormTags.Tags[Index].NumberOfLines++; FormTags.Tags[Index].NumberOfLines++;
} }
gBS->FreePool (OutputString); FreePool (OutputString);
} }
ArrayEntry = 0; ArrayEntry = 0;
@ -1113,9 +1113,9 @@ Routine Description:
The function does the most of the works when the EFI_TAG that The function does the most of the works when the EFI_TAG that
user selects on is EFI_IFR_FLAG_INTERACTIVE or EFI_IFR_PASSWORD_OP: user selects on is EFI_IFR_FLAG_INTERACTIVE or EFI_IFR_PASSWORD_OP:
invoke CallBack, update the new form data. invoke CallBack, update the new form data.
Arguments: Arguments:
Selection - The current selection of the form. Selection - The current selection of the form.
CallbackData - The pointer to host the data passed back by the callback function. CallbackData - The pointer to host the data passed back by the callback function.
FileFormTagsHead - Prompt string token of the one-of box FileFormTagsHead - Prompt string token of the one-of box
@ -1123,10 +1123,10 @@ Arguments:
FormHandle - Output the the handle of the form. FormHandle - Output the the handle of the form.
TitleToken - Output the TitleToken of the new page. TitleToken - Output the TitleToken of the new page.
FormTags - Output the FormFags of the new page. FormTags - Output the FormFags of the new page.
Returns: Returns:
VOID VOID
--*/ --*/
{ {
UINTN Index; UINTN Index;
@ -1212,7 +1212,7 @@ Returns:
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (LocalTags->Tags); FreePool (LocalTags->Tags);
return ; return ;
} }
@ -1317,7 +1317,7 @@ Returns:
} }
if (Packet != NULL) { if (Packet != NULL) {
gBS->FreePool (Packet); FreePool (Packet);
} }
for (BackupIndex = 0; LocalTags->Tags[BackupIndex].Operand != EFI_IFR_END_FORM_OP; BackupIndex++) { for (BackupIndex = 0; LocalTags->Tags[BackupIndex].Operand != EFI_IFR_END_FORM_OP; BackupIndex++) {
@ -1347,7 +1347,7 @@ Returns:
// Delete the buffer associated with previous dynamic page // Delete the buffer associated with previous dynamic page
// We will re-allocate a buffer.... // We will re-allocate a buffer....
// //
gBS->FreePool (LocalTags->Tags); FreePool (LocalTags->Tags);
Length = 0xF000; Length = 0xF000;
Buffer = AllocateZeroPool (Length); Buffer = AllocateZeroPool (Length);

View File

@ -1,13 +1,13 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
@ -16,9 +16,9 @@ Module Name:
Abstract: Abstract:
Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
simple implemenation of SPrint() and Print() to support debug. simple implemenation of SPrint() and Print() to support debug.
You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
time. This makes the implementation very simple. time. This makes the implementation very simple.
VSPrint, Print, SPrint format specification has the follwoing form VSPrint, Print, SPrint format specification has the follwoing form
@ -122,8 +122,8 @@ _IPrint (
// //
Out->OutputString (Out, &BackupBuffer[PreviousIndex]); Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
gBS->FreePool (Buffer); FreePool (Buffer);
gBS->FreePool (BackupBuffer); FreePool (BackupBuffer);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -202,51 +202,6 @@ Returns:
return Print ((CHAR16 *) L"%c", Character); return Print ((CHAR16 *) L"%c", Character);
} }
/*
UINTN
PrintToken (
IN EFI_HII_HANDLE Handle,
IN UINT16 Token,
IN CHAR16 *Language,
...
)
{
VA_LIST args;
UINTN NumberOfHiiHandles;
EFI_HANDLE *HandleBuffer;
EFI_HII_PROTOCOL *Hii;
//
// There should only be one HII image
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiHiiProtocolGuid,
NULL,
&NumberOfHiiHandles,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Retrieve the Hii protocol interface
//
Status = gBS->HandleProtocol (
HandleBuffer[0],
&gEfiHiiProtocolGuid,
&Hii
);
Hii->GetString (Hii, Handle, Token, FALSE, Language,
VA_START (args, fmt);
return _IPrint ((UINTN) -1, (UINTN) -1, gST->ConOut, fmt, args);
}
*/
UINTN UINTN
PrintAt ( PrintAt (
IN UINTN Column, IN UINTN Column,
@ -258,7 +213,7 @@ PrintAt (
Routine Description: Routine Description:
Prints a formatted unicode string to the default console, at Prints a formatted unicode string to the default console, at
the supplied cursor position the supplied cursor position
Arguments: Arguments:
@ -289,7 +244,7 @@ PrintStringAt (
Routine Description: Routine Description:
Prints a unicode string to the default console, at Prints a unicode string to the default console, at
the supplied cursor position, using L"%s" format. the supplied cursor position, using L"%s" format.
Arguments: Arguments:
@ -317,7 +272,7 @@ PrintCharAt (
Routine Description: Routine Description:
Prints a chracter to the default console, at Prints a chracter to the default console, at
the supplied cursor position, using L"%c" format. the supplied cursor position, using L"%c" format.
Arguments: Arguments:

View File

@ -138,7 +138,7 @@ AdjustNvMap (
} }
} }
gBS->FreePool (VariableDefinition->NvRamMap); FreePool (VariableDefinition->NvRamMap);
VariableDefinition->NvRamMap = NvRamMap; VariableDefinition->NvRamMap = NvRamMap;
VariableDefinition->VariableFakeSize = (UINT16) SizeRequired; VariableDefinition->VariableFakeSize = (UINT16) SizeRequired;
} }
@ -226,7 +226,7 @@ ProcessOptions (
); );
if (*OptionString != NULL) { if (*OptionString != NULL) {
gBS->FreePool (*OptionString); FreePool (*OptionString);
*OptionString = NULL; *OptionString = NULL;
} }
@ -311,7 +311,7 @@ ProcessOptions (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) { if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
CopyMem (NvRamMap, ValueArray, MenuOption->ThisTag->StorageWidth); CopyMem (NvRamMap, ValueArray, MenuOption->ThisTag->StorageWidth);
gBS->FreePool (ValueArray); FreePool (ValueArray);
} else { } else {
// //
// Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
@ -359,7 +359,7 @@ ProcessOptions (
// Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
// //
CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth); CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth);
gBS->FreePool (StringPtr); FreePool (StringPtr);
break; break;
default: default:
@ -372,7 +372,7 @@ ProcessOptions (
UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE); UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
} else { } else {
if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) { if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
gBS->FreePool (ValueArray); FreePool (ValueArray);
} }
return EFI_SUCCESS; return EFI_SUCCESS;
@ -434,7 +434,7 @@ ProcessOptions (
// //
// Remove Buffer allocated for StringPtr after it has been used. // Remove Buffer allocated for StringPtr after it has been used.
// //
gBS->FreePool (StringPtr); FreePool (StringPtr);
} else { } else {
// //
// The option value is the same as what is stored in NV store. Print this. // The option value is the same as what is stored in NV store. Print this.
@ -447,7 +447,7 @@ ProcessOptions (
// //
// Remove Buffer allocated for StringPtr after it has been used. // Remove Buffer allocated for StringPtr after it has been used.
// //
gBS->FreePool (StringPtr); FreePool (StringPtr);
Default = 0; Default = 0;
break; break;
} }
@ -475,7 +475,7 @@ ProcessOptions (
// //
// Remove Buffer allocated for StringPtr after it has been used. // Remove Buffer allocated for StringPtr after it has been used.
// //
gBS->FreePool (StringPtr); FreePool (StringPtr);
} }
} }
break; break;
@ -1028,7 +1028,7 @@ ProcessOptions (
UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE); UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
} }
gBS->FreePool (StringPtr); FreePool (StringPtr);
return Status; return Status;
} else { } else {
for (Index = 0; Index < gOptionBlockWidth; Index++) { for (Index = 0; Index < gOptionBlockWidth; Index++) {
@ -1073,13 +1073,13 @@ ProcessOptions (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_READY) { if (Status == EFI_NOT_READY) {
gBS->FreePool (StringPtr); FreePool (StringPtr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
Status = ReadPassword (MenuOption, TRUE, Tag, PageData, TRUE, FileFormTags, StringPtr); Status = ReadPassword (MenuOption, TRUE, Tag, PageData, TRUE, FileFormTags, StringPtr);
gBS->FreePool (StringPtr); FreePool (StringPtr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1090,7 +1090,7 @@ ProcessOptions (
// //
Status = ReadPassword (MenuOption, TRUE, Tag, PageData, FALSE, FileFormTags, StringPtr); Status = ReadPassword (MenuOption, TRUE, Tag, PageData, FALSE, FileFormTags, StringPtr);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (StringPtr); FreePool (StringPtr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1102,7 +1102,7 @@ ProcessOptions (
} }
if (Status != 0) { if (Status != 0) {
gBS->FreePool (StringPtr); FreePool (StringPtr);
return EFI_SUCCESS; return EFI_SUCCESS;
} else { } else {
break; break;
@ -1123,7 +1123,7 @@ ProcessOptions (
// //
// User couldn't figure out how to type two identical passwords // User couldn't figure out how to type two identical passwords
// //
gBS->FreePool (StringPtr); FreePool (StringPtr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
// //
@ -1180,8 +1180,8 @@ ProcessOptions (
); );
} }
gBS->FreePool (TmpNvRamMap); FreePool (TmpNvRamMap);
gBS->FreePool (StringPtr); FreePool (StringPtr);
break; break;
} }

View File

@ -1,14 +1,14 @@
/**@file /**@file
Entry and initialization module for the browser. Entry and initialization module for the browser.
Copyright (c) 2006 - 2007 Intel Corporation. <BR> Copyright (c) 2006 - 2007 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
@ -21,7 +21,7 @@ FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
// //
{ {
{ {
0x847bc3fe, 0x847bc3fe,
0xb974, 0xb974,
0x446d, 0x446d,
{ {
@ -162,7 +162,7 @@ SendForm (
Routine Description: Routine Description:
This is the routine which an external caller uses to direct the browser This is the routine which an external caller uses to direct the browser
where to obtain it's information. where to obtain it's information.
Arguments: Arguments:
@ -185,7 +185,7 @@ Arguments:
needs to provide to the browser the current settings for the "fake" NV variable. If used, no saving needs to provide to the browser the current settings for the "fake" NV variable. If used, no saving
of an NV variable will be possible. This parameter is also ignored if HandleCount > 1. of an NV variable will be possible. This parameter is also ignored if HandleCount > 1.
Returns: Returns:
--*/ --*/
{ {
@ -292,7 +292,7 @@ Returns:
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (CallbackData); FreePool (CallbackData);
return Status;; return Status;;
} }
@ -304,7 +304,7 @@ Returns:
Status = InitializeBinaryStructures (Handle, UseDatabase, Packet, NvMapOverride, HandleCount, &FileFormTagsHead); Status = InitializeBinaryStructures (Handle, UseDatabase, Packet, NvMapOverride, HandleCount, &FileFormTagsHead);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (CallbackData); FreePool (CallbackData);
return Status; return Status;
} }
// //
@ -327,7 +327,7 @@ Returns:
if (UseDatabase && (HandleCount > 1)) { if (UseDatabase && (HandleCount > 1)) {
if (Selection == NULL) { if (Selection == NULL) {
gBS->FreePool (CallbackData); FreePool (CallbackData);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
@ -357,12 +357,12 @@ Returns:
*Handle = BackupHandle; *Handle = BackupHandle;
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (CallbackData); FreePool (CallbackData);
return Status; return Status;
} }
if (Callback && (AltSelection == NULL)) { if (Callback && (AltSelection == NULL)) {
gBS->FreePool (CallbackData); FreePool (CallbackData);
return Status; return Status;
} }
@ -379,7 +379,7 @@ Returns:
// //
// If this is the FrontPage, return after every selection // If this is the FrontPage, return after every selection
// //
gBS->FreePool (Selection); FreePool (Selection);
UiFreeMenu (); UiFreeMenu ();
// //
@ -390,11 +390,11 @@ Returns:
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->ClearScreen (gST->ConOut); gST->ConOut->ClearScreen (gST->ConOut);
gBS->FreePool (CallbackData); FreePool (CallbackData);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
gBS->FreePool (Selection); FreePool (Selection);
UiFreeMenu (); UiFreeMenu ();
// //
@ -405,14 +405,14 @@ Returns:
gST->ConOut->ClearScreen (gST->ConOut); gST->ConOut->ClearScreen (gST->ConOut);
if (!Callback) { if (!Callback) {
gBS->FreePool (CallbackData); FreePool (CallbackData);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
} while (!EFI_ERROR (Status)); } while (!EFI_ERROR (Status));
gBS->FreePool (CallbackData); FreePool (CallbackData);
return Status; return Status;
} }
@ -426,11 +426,11 @@ InitializeSetup (
Routine Description: Routine Description:
Initialize Setup Initialize Setup
Arguments: Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT) (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns: Returns:
EFI_SUCCESS - Setup loaded. EFI_SUCCESS - Setup loaded.
other - Setup Error other - Setup Error
@ -491,7 +491,7 @@ Returns:
Status = Hii->NewPack (Hii, PackageList, &gHiiHandle); Status = Hii->NewPack (Hii, PackageList, &gHiiHandle);
gBS->FreePool (PackageList); FreePool (PackageList);
// //
// Install protocol interface // Install protocol interface
@ -532,7 +532,7 @@ Arguments:
Index - Offset of the current opcode in the Ifr raw data. Index - Offset of the current opcode in the Ifr raw data.
FileFormTags - Pointer of current EFI_FILE_FORM_TAGS structure. FileFormTags - Pointer of current EFI_FILE_FORM_TAGS structure.
CurrentVariable - Current variable number. CurrentVariable - Current variable number.
Returns: Returns:
None. None.
--*/ --*/
@ -605,7 +605,7 @@ Arguments:
NumberOfLines - Number of lines this opcode occupied. NumberOfLines - Number of lines this opcode occupied.
FileFormTags - Pointer of current EFI_FILE_FORM_TAGS structure. FileFormTags - Pointer of current EFI_FILE_FORM_TAGS structure.
CurrentVariable - Current variable number. CurrentVariable - Current variable number.
Returns: Returns:
None. None.
--*/ --*/
@ -661,7 +661,7 @@ Returns:
CopyMem (&Tag->Value, &Tag->Default, sizeof (UINT16)); CopyMem (&Tag->Value, &Tag->Default, sizeof (UINT16));
} }
break; break;
} }
} }
} }
@ -713,11 +713,11 @@ AddNextInconsistentTag (
Routine Description: Routine Description:
Initialize the next inconsistent tag data and add it to the inconsistent tag list. Initialize the next inconsistent tag data and add it to the inconsistent tag list.
Arguments: Arguments:
InconsistentTagsPtr - Pointer of the inconsistent tag's pointer. InconsistentTagsPtr - Pointer of the inconsistent tag's pointer.
Returns: Returns:
None. None.
--*/ --*/
@ -829,13 +829,14 @@ InitializeTagStructures (
// //
for (Index = 0; Index < NumberOfTags; Index++) { for (Index = 0; Index < NumberOfTags; Index++) {
if (FormTags->Tags[Index].IntList != NULL) { if (FormTags->Tags[Index].IntList != NULL) {
gBS->FreePool (FormTags->Tags[Index].IntList); FreePool (FormTags->Tags[Index].IntList);
} }
} }
gBS->FreePool (FormTags->Tags); FreePool (FormTags->Tags);
gBS->FreePool (FormTags->Next);
FormTags->Next = NULL; ASSERT (FormTags->Next == NULL);
FormTags->Tags = NULL; FormTags->Tags = NULL;
FormTags = SavedFormTags; FormTags = SavedFormTags;
@ -1350,7 +1351,7 @@ InitializeTagStructures (
// Since this op-code doesn't use the next field(s), initialize them with something invalid. // Since this op-code doesn't use the next field(s), initialize them with something invalid.
// Unfortunately 0 is a valid offset value for a QuestionId // Unfortunately 0 is a valid offset value for a QuestionId
// //
// //
// Reserve INVALID_OFFSET_VALUE - 1 for TRUE or FALSE because they are inconsistency tags also, but // Reserve INVALID_OFFSET_VALUE - 1 for TRUE or FALSE because they are inconsistency tags also, but
// have no coresponding id. The examination of id is needed by evaluating boolean expression. // have no coresponding id. The examination of id is needed by evaluating boolean expression.
@ -1571,8 +1572,8 @@ InitPage (
HomeEscapeString HomeEscapeString
); );
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gBS->FreePool (HomeEscapeString); FreePool (HomeEscapeString);
gBS->FreePool (HomePageString); FreePool (HomePageString);
return ; return ;
} }
@ -1585,14 +1586,14 @@ GetToken (
/*++ /*++
Routine Description: Routine Description:
Get the string based on the TokenID and HII Handle. Get the string based on the TokenID and HII Handle.
Arguments: Arguments:
Token - The Token ID. Token - The Token ID.
HiiHandle - Handle of Ifr to be fetched. HiiHandle - Handle of Ifr to be fetched.
Returns: Returns:
The output string. The output string.
@ -1618,7 +1619,7 @@ Returns:
// //
// Free the old pool // Free the old pool
// //
gBS->FreePool (Buffer); FreePool (Buffer);
// //
// Allocate new pool with correct value // Allocate new pool with correct value
@ -1955,8 +1956,8 @@ InitializeBinaryStructures (
// //
// Free the buffer that was allocated that was too small // Free the buffer that was allocated that was too small
// //
gBS->FreePool (VariableDefinition->NvRamMap); FreePool (VariableDefinition->NvRamMap);
gBS->FreePool (VariableDefinition->FakeNvRamMap); FreePool (VariableDefinition->FakeNvRamMap);
VariableDefinition->NvRamMap = AllocateZeroPool (SizeOfNvStore); VariableDefinition->NvRamMap = AllocateZeroPool (SizeOfNvStore);
VariableDefinition->FakeNvRamMap = AllocateZeroPool (SizeOfNvStore + VariableDefinition->VariableFakeSize); VariableDefinition->FakeNvRamMap = AllocateZeroPool (SizeOfNvStore + VariableDefinition->VariableFakeSize);
@ -1986,18 +1987,18 @@ InitializeBinaryStructures (
// if the variable was not found, we will retrieve default values // if the variable was not found, we will retrieve default values
// //
if (Status == EFI_NOT_FOUND) { if (Status == EFI_NOT_FOUND) {
if (0 == CompareMem (VariableDefinition->VariableName, L"Setup", 10)) { if (0 == CompareMem (VariableDefinition->VariableName, L"Setup", 10)) {
NvMapListHead = NULL; NvMapListHead = NULL;
Status = Hii->GetDefaultImage (Hii, Handle[HandleIndex], EFI_IFR_FLAG_DEFAULT, &NvMapListHead); Status = Hii->GetDefaultImage (Hii, Handle[HandleIndex], EFI_IFR_FLAG_DEFAULT, &NvMapListHead);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (NULL != NvMapListHead); ASSERT_EFI_ERROR (NULL != NvMapListHead);
NvMapListNode = NvMapListHead; NvMapListNode = NvMapListHead;
while (NULL != NvMapListNode) { while (NULL != NvMapListNode) {
if (VariableDefinition->VariableId == NvMapListNode->VariablePack->VariableId) { if (VariableDefinition->VariableId == NvMapListNode->VariablePack->VariableId) {
NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength); NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);
@ -2006,25 +2007,25 @@ InitializeBinaryStructures (
} }
NvMapListNode = NvMapListNode->NextVariablePack; NvMapListNode = NvMapListNode->NextVariablePack;
} }
// //
// Free the buffer that was allocated. // Free the buffer that was allocated.
// //
gBS->FreePool (VariableDefinition->NvRamMap); FreePool (VariableDefinition->NvRamMap);
gBS->FreePool (VariableDefinition->FakeNvRamMap); FreePool (VariableDefinition->FakeNvRamMap);
// //
// Allocate, copy the NvRamMap. // Allocate, copy the NvRamMap.
// //
VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize - VariableDefinition->VariableSize); VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize - VariableDefinition->VariableSize);
VariableDefinition->VariableSize = (UINT16) NvMapSize; VariableDefinition->VariableSize = (UINT16) NvMapSize;
VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + VariableDefinition->VariableSize); VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + VariableDefinition->VariableSize);
VariableDefinition->NvRamMap = AllocateZeroPool (VariableDefinition->VariableSize); VariableDefinition->NvRamMap = AllocateZeroPool (VariableDefinition->VariableSize);
VariableDefinition->FakeNvRamMap = AllocateZeroPool (NvMapSize + VariableDefinition->VariableFakeSize); VariableDefinition->FakeNvRamMap = AllocateZeroPool (NvMapSize + VariableDefinition->VariableFakeSize);
CopyMem (VariableDefinition->NvRamMap, NvMap, NvMapSize); CopyMem (VariableDefinition->NvRamMap, NvMap, NvMapSize);
gBS->FreePool (NvMapListHead); FreePool (NvMapListHead);
} }
} }
@ -2060,7 +2061,7 @@ Arguments:
HiiHandle - Handle of Ifr to be fetched. HiiHandle - Handle of Ifr to be fetched.
Packet - Pointer to IFR packet. Packet - Pointer to IFR packet.
BinaryData - Buffer to copy the string into BinaryData - Buffer to copy the string into
Returns: Returns:
Returns the number of CHAR16 characters that were copied into the OutputString buffer. Returns the number of CHAR16 characters that were copied into the OutputString buffer.
@ -2098,7 +2099,7 @@ Returns:
if (Status == EFI_BUFFER_TOO_SMALL) { if (Status == EFI_BUFFER_TOO_SMALL) {
gBS->FreePool (Buffer); FreePool (Buffer);
// //
// Allocate memory for our Form binary // Allocate memory for our Form binary
@ -2121,7 +2122,7 @@ Returns:
Status = Hii->NewPack (Hii, PackageList, &HiiHandle); Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
gBS->FreePool (PackageList); FreePool (PackageList);
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {

View File

@ -1,14 +1,14 @@
/**@file /**@file
Implementation for UI. Implementation for UI.
Copyright (c) 2006 - 2007, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
@ -63,7 +63,7 @@ Routine Description:
Initialize Menu option list. Initialize Menu option list.
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -81,7 +81,7 @@ Routine Description:
Initialize Menu option list. Initialize Menu option list.
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -100,7 +100,7 @@ Routine Description:
Remove Menu option list. Remove Menu option list.
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -119,7 +119,7 @@ Returns:
(*PreviousSelection)->Handle = UiMenuList->Selection.Handle; (*PreviousSelection)->Handle = UiMenuList->Selection.Handle;
gEntryNumber = UiMenuList->FormerEntryNumber; gEntryNumber = UiMenuList->FormerEntryNumber;
RemoveEntryList (&UiMenuList->MenuLink); RemoveEntryList (&UiMenuList->MenuLink);
gBS->FreePool (UiMenuList); FreePool (UiMenuList);
} }
} }
@ -133,7 +133,7 @@ Routine Description:
Free Menu option linked list. Free Menu option linked list.
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -143,7 +143,7 @@ Returns:
while (!IsListEmpty (&gMenuList)) { while (!IsListEmpty (&gMenuList)) {
UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE); UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
RemoveEntryList (&UiMenuList->MenuLink); RemoveEntryList (&UiMenuList->MenuLink);
gBS->FreePool (UiMenuList); FreePool (UiMenuList);
} }
} }
@ -157,7 +157,7 @@ Routine Description:
Add one menu entry to the linked lst Add one menu entry to the linked lst
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -183,7 +183,7 @@ Routine Description:
Free Menu option linked list. Free Menu option linked list.
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -197,8 +197,8 @@ Returns:
// //
// We allocated space for this description when we did a GetToken, free it here // We allocated space for this description when we did a GetToken, free it here
// //
gBS->FreePool (MenuOption->Description); FreePool (MenuOption->Description);
gBS->FreePool (MenuOption); FreePool (MenuOption);
} }
} }
@ -213,7 +213,7 @@ Routine Description:
Refresh screen with current date and/or time based on screen context Refresh screen with current date and/or time based on screen context
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -256,7 +256,7 @@ Returns:
} }
if (OptionString != NULL) { if (OptionString != NULL) {
gBS->FreePool (OptionString); FreePool (OptionString);
} }
} }
@ -373,7 +373,7 @@ Routine Description:
Arguments: Arguments:
String - String description for this option. String - String description for this option.
Context - Context data for entry. Context - Context data for entry.
Returns: Returns:
--*/ --*/
@ -414,7 +414,7 @@ Routine Description:
Arguments: Arguments:
String - String description for this option. String - String description for this option.
Context - Context data for entry. Context - Context data for entry.
Returns: Returns:
--*/ --*/
@ -457,7 +457,7 @@ Routine Description:
Arguments: Arguments:
NumberOfLines - The number of lines for the dialog box NumberOfLines - The number of lines for the dialog box
HotKey - Defines whether a single character is parsed (TRUE) and returned in KeyValue HotKey - Defines whether a single character is parsed (TRUE) and returned in KeyValue
or a string is returned in StringBuffer. Two special characters are considered when entering a string, a SCAN_ESC and or a string is returned in StringBuffer. Two special characters are considered when entering a string, a SCAN_ESC and
an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates string input and returns an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates string input and returns
MaximumStringSize - The maximum size in bytes of a typed in string (each character is a CHAR16) and the minimum string returned is two bytes MaximumStringSize - The maximum size in bytes of a typed in string (each character is a CHAR16) and the minimum string returned is two bytes
@ -465,7 +465,7 @@ Arguments:
KeyValue - The EFI_KEY value returned if HotKey is TRUE.. KeyValue - The EFI_KEY value returned if HotKey is TRUE..
String - Pointer to the first string in the list String - Pointer to the first string in the list
... - A series of (quantity == NumberOfLines) text strings which will be used to construct the dialog box ... - A series of (quantity == NumberOfLines) text strings which will be used to construct the dialog box
Returns: Returns:
EFI_SUCCESS - Displayed dialog and received user interaction EFI_SUCCESS - Displayed dialog and received user interaction
EFI_INVALID_PARAMETER - One of the parameters was invalid (e.g. (StringBuffer == NULL) && (HotKey == FALSE)) EFI_INVALID_PARAMETER - One of the parameters was invalid (e.g. (StringBuffer == NULL) && (HotKey == FALSE))
@ -572,8 +572,8 @@ Returns:
case CHAR_NULL: case CHAR_NULL:
switch (Key.ScanCode) { switch (Key.ScanCode) {
case SCAN_ESC: case SCAN_ESC:
gBS->FreePool (TempString); FreePool (TempString);
gBS->FreePool (BufferedString); FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute); gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
gST->ConOut->EnableCursor (gST->ConOut, TRUE); gST->ConOut->EnableCursor (gST->ConOut, TRUE);
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
@ -586,8 +586,8 @@ Returns:
case CHAR_CARRIAGE_RETURN: case CHAR_CARRIAGE_RETURN:
SelectionComplete = TRUE; SelectionComplete = TRUE;
gBS->FreePool (TempString); FreePool (TempString);
gBS->FreePool (BufferedString); FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute); gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
gST->ConOut->EnableCursor (gST->ConOut, TRUE); gST->ConOut->EnableCursor (gST->ConOut, TRUE);
return EFI_SUCCESS; return EFI_SUCCESS;
@ -829,8 +829,8 @@ UpdateStatusBar (
break; break;
} }
gBS->FreePool (InputErrorMessage); FreePool (InputErrorMessage);
gBS->FreePool (NvUpdateMessage); FreePool (NvUpdateMessage);
return ; return ;
} }
@ -843,11 +843,11 @@ FreeData (
/*++ /*++
Routine Description: Routine Description:
Used to remove the allocated data instances Used to remove the allocated data instances
Arguments: Arguments:
Returns: Returns:
--*/ --*/
@ -867,11 +867,11 @@ Returns:
FileForm = FileFormTagsHead; FileForm = FileFormTagsHead;
if (FormattedString != NULL) { if (FormattedString != NULL) {
gBS->FreePool (FormattedString); FreePool (FormattedString);
} }
if (OptionString != NULL) { if (OptionString != NULL) {
gBS->FreePool (OptionString); FreePool (OptionString);
} }
for (; FileForm != NULL;) { for (; FileForm != NULL;) {
@ -908,17 +908,17 @@ Returns:
} }
if (FormTags->Tags[Index].IntList != NULL) { if (FormTags->Tags[Index].IntList != NULL) {
gBS->FreePool (FormTags->Tags[Index].IntList); FreePool (FormTags->Tags[Index].IntList);
} }
} }
if (PreviousFormTags != NULL) { if (PreviousFormTags != NULL) {
gBS->FreePool (FormTags->Tags); FreePool (FormTags->Tags);
FormTags = PreviousFormTags; FormTags = PreviousFormTags;
gBS->FreePool (FormTags->Next); FreePool (FormTags->Next);
FormTags->Next = NULL; FormTags->Next = NULL;
} else { } else {
gBS->FreePool (FormTags->Tags); FreePool (FormTags->Tags);
FormTags = NULL; FormTags = NULL;
} }
} }
@ -942,7 +942,7 @@ Returns:
// //
// Free the current entry // Free the current entry
// //
gBS->FreePool (Inconsistent); FreePool (Inconsistent);
// //
// Restore the Previous pointer // Restore the Previous pointer
@ -963,26 +963,32 @@ Returns:
PreviousVariableDefinition = VariableDefinition; PreviousVariableDefinition = VariableDefinition;
} }
gBS->FreePool (VariableDefinition->VariableName); FreePool (VariableDefinition->VariableName);
gBS->FreePool (VariableDefinition->NvRamMap);
gBS->FreePool (VariableDefinition->FakeNvRamMap); if (VariableDefinition->NvRamMap != NULL) {
FreePool (VariableDefinition->NvRamMap);
}
if (VariableDefinition->FakeNvRamMap != NULL) {
FreePool (VariableDefinition->FakeNvRamMap);
}
if (PreviousVariableDefinition != NULL) { if (PreviousVariableDefinition != NULL) {
VariableDefinition = PreviousVariableDefinition; VariableDefinition = PreviousVariableDefinition;
gBS->FreePool (VariableDefinition->Next); FreePool (VariableDefinition->Next);
VariableDefinition->Next = NULL; VariableDefinition->Next = NULL;
} else { } else {
gBS->FreePool (VariableDefinition); FreePool (VariableDefinition);
VariableDefinition = NULL; VariableDefinition = NULL;
} }
} }
if (PreviousFileForm != NULL) { if (PreviousFileForm != NULL) {
FileForm = PreviousFileForm; FileForm = PreviousFileForm;
gBS->FreePool (FileForm->NextFile); FreePool (FileForm->NextFile);
FileForm->NextFile = NULL; FileForm->NextFile = NULL;
} else { } else {
gBS->FreePool (FileForm); FreePool (FileForm);
FileForm = NULL; FileForm = NULL;
} }
} }
@ -1000,40 +1006,40 @@ Returns:
PreviousIfrBinary = IfrBinary; PreviousIfrBinary = IfrBinary;
} }
gBS->FreePool (IfrBinary->IfrPackage); FreePool (IfrBinary->IfrPackage);
if (PreviousIfrBinary != NULL) { if (PreviousIfrBinary != NULL) {
IfrBinary = PreviousIfrBinary; IfrBinary = PreviousIfrBinary;
gBS->FreePool (IfrBinary->Next); FreePool (IfrBinary->Next);
IfrBinary->Next = NULL; IfrBinary->Next = NULL;
} else { } else {
gBS->FreePool (IfrBinary); FreePool (IfrBinary);
IfrBinary = NULL; IfrBinary = NULL;
} }
} }
gBS->FreePool (gPreviousValue); FreePool (gPreviousValue);
gPreviousValue = NULL; gPreviousValue = NULL;
// //
// Free Browser Strings // Free Browser Strings
// //
gBS->FreePool (gPressEnter); FreePool (gPressEnter);
gBS->FreePool (gConfirmError); FreePool (gConfirmError);
gBS->FreePool (gConfirmPassword); FreePool (gConfirmPassword);
gBS->FreePool (gPromptForNewPassword); FreePool (gPromptForNewPassword);
gBS->FreePool (gPromptForPassword); FreePool (gPromptForPassword);
gBS->FreePool (gToggleCheckBox); FreePool (gToggleCheckBox);
gBS->FreePool (gNumericInput); FreePool (gNumericInput);
gBS->FreePool (gMakeSelection); FreePool (gMakeSelection);
gBS->FreePool (gMoveHighlight); FreePool (gMoveHighlight);
gBS->FreePool (gEscapeString); FreePool (gEscapeString);
gBS->FreePool (gEnterCommitString); FreePool (gEnterCommitString);
gBS->FreePool (gEnterString); FreePool (gEnterString);
gBS->FreePool (gFunctionOneString); FreePool (gFunctionOneString);
gBS->FreePool (gFunctionTwoString); FreePool (gFunctionTwoString);
gBS->FreePool (gFunctionNineString); FreePool (gFunctionNineString);
gBS->FreePool (gFunctionTenString); FreePool (gFunctionTenString);
return ; return ;
} }
@ -1046,11 +1052,11 @@ SelectionsAreValid (
/*++ /*++
Routine Description: Routine Description:
Initiate late consistency checks against the current page. Initiate late consistency checks against the current page.
Arguments: Arguments:
None None
Returns: Returns:
--*/ --*/
@ -1103,7 +1109,7 @@ Returns:
// Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
// //
CopyMem (NvRamMap, &Tag->OldValue, Tag->StorageWidth); CopyMem (NvRamMap, &Tag->OldValue, Tag->StorageWidth);
gBS->FreePool (StringPtr); FreePool (StringPtr);
break; break;
default: default:
@ -1133,7 +1139,7 @@ Routine Description:
Arguments: Arguments:
Tag - The Tag structure passed in. Tag - The Tag structure passed in.
Handle - The handle in the HII database being used Handle - The handle in the HII database being used
Returns: Returns:
Returns the number of CHAR16 characters that is support. Returns the number of CHAR16 characters that is support.
@ -1151,7 +1157,7 @@ Returns:
if ((Tag->Operand == EFI_IFR_TEXT_OP) && (Tag->TextTwo != 0)) { if ((Tag->Operand == EFI_IFR_TEXT_OP) && (Tag->TextTwo != 0)) {
String = GetToken (Tag->TextTwo, Handle); String = GetToken (Tag->TextTwo, Handle);
Size = StrLen (String); Size = StrLen (String);
gBS->FreePool (String); FreePool (String);
} }
if ((Tag->Operand == EFI_IFR_SUBTITLE_OP) || if ((Tag->Operand == EFI_IFR_SUBTITLE_OP) ||
@ -1188,7 +1194,7 @@ Arguments:
LineWidth - Width of the desired string to extract in CHAR16 characters LineWidth - Width of the desired string to extract in CHAR16 characters
Index - Where in InputString to start the copy process Index - Where in InputString to start the copy process
OutputString - Buffer to copy the string into OutputString - Buffer to copy the string into
Returns: Returns:
Returns the number of CHAR16 characters that were copied into the OutputString buffer. Returns the number of CHAR16 characters that were copied into the OutputString buffer.
@ -1213,14 +1219,14 @@ Returns:
// Ensure we have got a valid buffer // Ensure we have got a valid buffer
// //
if (*OutputString != NULL) { if (*OutputString != NULL) {
// //
//NARROW_CHAR can not be printed in screen, so if a line only contain the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line in Screen. //NARROW_CHAR can not be printed in screen, so if a line only contain the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line in Screen.
//To avoid displaying this empty line in screen, just skip the two CHARs here. //To avoid displaying this empty line in screen, just skip the two CHARs here.
// //
if ((InputString[*Index] == NARROW_CHAR) && (InputString[*Index + 1] == CHAR_CARRIAGE_RETURN)) { if ((InputString[*Index] == NARROW_CHAR) && (InputString[*Index + 1] == CHAR_CARRIAGE_RETURN)) {
*Index = *Index + 2; *Index = *Index + 2;
} }
// //
// Fast-forward the string and see if there is a carriage-return in the string // Fast-forward the string and see if there is a carriage-return in the string
@ -1323,7 +1329,7 @@ UpdateOptionSkipLines (
} }
} }
gBS->FreePool (OutputString); FreePool (OutputString);
if (SkipValue != 0) { if (SkipValue != 0) {
SkipValue--; SkipValue--;
} }
@ -1382,9 +1388,9 @@ Arguments:
SubMenu - Indicate is sub menu. SubMenu - Indicate is sub menu.
FileFormTagsHead - A pointer to the EFI_FILE_FORM_TAGS structure. FileFormTagsHead - A pointer to the EFI_FILE_FORM_TAGS structure.
PageData - A pointer to the EFI_IFR_DATA_ARRAY. PageData - A pointer to the EFI_IFR_DATA_ARRAY.
Returns: Returns:
Return the pointer of the menu which selected, Return the pointer of the menu which selected,
otherwise return NULL. otherwise return NULL.
--*/ --*/
@ -1548,7 +1554,7 @@ Returns:
while (gMenuRefreshHead != NULL) { while (gMenuRefreshHead != NULL) {
OldMenuRefreshEntry = gMenuRefreshHead->Next; OldMenuRefreshEntry = gMenuRefreshHead->Next;
gBS->FreePool (gMenuRefreshHead); FreePool (gMenuRefreshHead);
gMenuRefreshHead = OldMenuRefreshEntry; gMenuRefreshHead = OldMenuRefreshEntry;
} }
@ -1586,7 +1592,7 @@ Returns:
} }
} }
gBS->FreePool (OutputString); FreePool (OutputString);
if (Temp != 0) { if (Temp != 0) {
Temp--; Temp--;
} }
@ -1681,7 +1687,7 @@ Returns:
} }
} }
gBS->FreePool (OutputString); FreePool (OutputString);
if (Temp2 != 0) { if (Temp2 != 0) {
Temp2--; Temp2--;
} }
@ -1723,14 +1729,14 @@ Returns:
} }
} }
gBS->FreePool (OutputString); FreePool (OutputString);
if (Temp2 != 0) { if (Temp2 != 0) {
Temp2--; Temp2--;
} }
} }
Row = OriginalRow; Row = OriginalRow;
gBS->FreePool (StringPtr); FreePool (StringPtr);
} }
} else { } else {
// //
@ -1848,7 +1854,7 @@ Returns:
MenuOption->Row++; MenuOption->Row++;
} }
gBS->FreePool (OutputString); FreePool (OutputString);
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -1876,7 +1882,7 @@ Returns:
MenuOption->Row++; MenuOption->Row++;
} }
gBS->FreePool (OutputString); FreePool (OutputString);
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -1969,7 +1975,7 @@ Returns:
MenuOption->Row++; MenuOption->Row++;
} }
gBS->FreePool (OutputString); FreePool (OutputString);
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -1990,7 +1996,7 @@ Returns:
MenuOption->Row++; MenuOption->Row++;
} }
gBS->FreePool (OutputString); FreePool (OutputString);
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -2022,10 +2028,10 @@ Returns:
case CfUpdateHelpString: case CfUpdateHelpString:
ControlFlag = CfPrepareToReadKey; ControlFlag = CfPrepareToReadKey;
if (SubMenu && if (SubMenu &&
(Repaint || NewLine || (Repaint || NewLine ||
(MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||
(MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) && (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) &&
!(gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS)) { !(gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS)) {
// //
// Don't print anything if it is a NULL help token // Don't print anything if it is a NULL help token
@ -2305,7 +2311,7 @@ Returns:
while (gMenuRefreshHead != NULL) { while (gMenuRefreshHead != NULL) {
OldMenuRefreshEntry = gMenuRefreshHead->Next; OldMenuRefreshEntry = gMenuRefreshHead->Next;
gBS->FreePool (gMenuRefreshHead); FreePool (gMenuRefreshHead);
gMenuRefreshHead = OldMenuRefreshEntry; gMenuRefreshHead = OldMenuRefreshEntry;
} }
@ -2328,7 +2334,7 @@ Returns:
ExtractRequestedNvMap (FileFormTags, MenuOption->ThisTag->VariableNumber, &VariableDefinition); ExtractRequestedNvMap (FileFormTags, MenuOption->ThisTag->VariableNumber, &VariableDefinition);
if (SubMenu) { if (SubMenu) {
if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP && if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP &&
!(MenuOption->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE)) || !(MenuOption->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE)) ||
(MenuOption->ThisTag->GrayOut) || (MenuOption->ThisTag->GrayOut) ||
(MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||
@ -2966,9 +2972,9 @@ Returns:
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (NULL != NvMapListHead); ASSERT_EFI_ERROR (NULL != NvMapListHead);
NvMapListNode = NvMapListHead; NvMapListNode = NvMapListHead;
while (NULL != NvMapListNode) { while (NULL != NvMapListNode) {
if (FileFormTags->VariableDefinitions->VariableId == NvMapListNode->VariablePack->VariableId) { if (FileFormTags->VariableDefinitions->VariableId == NvMapListNode->VariablePack->VariableId) {
NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength); NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);
@ -2977,20 +2983,20 @@ Returns:
} }
NvMapListNode = NvMapListNode->NextVariablePack; NvMapListNode = NvMapListNode->NextVariablePack;
} }
// //
// Free the buffer that was allocated. // Free the buffer that was allocated.
// //
gBS->FreePool (FileFormTags->VariableDefinitions->NvRamMap); FreePool (FileFormTags->VariableDefinitions->NvRamMap);
gBS->FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap); FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);
// //
// Allocate, copy the NvRamMap. // Allocate, copy the NvRamMap.
// //
FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize - FileFormTags->VariableDefinitions->VariableSize); FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize - FileFormTags->VariableDefinitions->VariableSize);
FileFormTags->VariableDefinitions->VariableSize = (UINT16) NvMapSize; FileFormTags->VariableDefinitions->VariableSize = (UINT16) NvMapSize;
FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize); FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize);
FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize); FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);
ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL); ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL);
@ -2998,7 +3004,7 @@ Returns:
ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL); ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL);
CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize); CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize);
gBS->FreePool (NvMapListHead); FreePool (NvMapListHead);
} }
UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, TRUE); UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, TRUE);
@ -3017,7 +3023,7 @@ Returns:
while (gMenuRefreshHead != NULL) { while (gMenuRefreshHead != NULL) {
OldMenuRefreshEntry = gMenuRefreshHead->Next; OldMenuRefreshEntry = gMenuRefreshHead->Next;
gBS->FreePool (gMenuRefreshHead); FreePool (gMenuRefreshHead);
gMenuRefreshHead = OldMenuRefreshEntry; gMenuRefreshHead = OldMenuRefreshEntry;
} }
@ -3043,11 +3049,11 @@ ValueIsScroll (
/*++ /*++
Routine Description: Routine Description:
Determine if the menu is the last menu that can be selected. Determine if the menu is the last menu that can be selected.
Arguments: Arguments:
Direction - the scroll direction. False is down. True is up. Direction - the scroll direction. False is down. True is up.
Returns: Returns:
FALSE -- the menu isn't the last menu that can be selected. FALSE -- the menu isn't the last menu that can be selected.
TRUE -- the menu is the last menu that can be selected. TRUE -- the menu is the last menu that can be selected.
@ -3087,9 +3093,9 @@ Routine Description:
Arguments: Arguments:
Direction - the up or down direction. False is down. True is up. Direction - the up or down direction. False is down. True is up.
CurrentPos - Current position. CurrentPos - Current position.
Returns: Returns:
Return line number to pad. It is possible that we stand on a zero-advance Return line number to pad. It is possible that we stand on a zero-advance
data or time opcode, so pad one line when we judge if we are going to scroll outside. data or time opcode, so pad one line when we judge if we are going to scroll outside.
--*/ --*/
{ {

View File

@ -424,13 +424,9 @@ Returns:
Variable = NextVariable; Variable = NextVariable;
} }
Status = gBS->AllocatePool ( ValidBuffer = AllocatePool (ValidBufferSize);
EfiBootServicesData, if (ValidBuffer == NULL) {
ValidBufferSize, return EFI_OUT_OF_RESOURCES;
(VOID **) &ValidBuffer
);
if (EFI_ERROR (Status)) {
return Status;
} }
SetMem (ValidBuffer, ValidBufferSize, 0xff); SetMem (ValidBuffer, ValidBufferSize, 0xff);
@ -481,7 +477,7 @@ Returns:
} }
} }
gBS->FreePool (ValidBuffer); FreePool (ValidBuffer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
*LastVariableOffset = 0; *LastVariableOffset = 0;
@ -1253,13 +1249,13 @@ Returns:
*RemainingVariableStorageSize -= VariableSize; *RemainingVariableStorageSize -= VariableSize;
} }
} }
// //
// Go to the next one // Go to the next one
// //
Variable = NextVariable; Variable = NextVariable;
} }
ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock); ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1308,14 +1304,9 @@ Returns:
UINTN Index; UINTN Index;
UINT8 Data; UINT8 Data;
Status = gBS->AllocatePool ( mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL));
EfiRuntimeServicesData, if (mVariableModuleGlobal == NULL) {
sizeof (ESAL_VARIABLE_GLOBAL), return EFI_OUT_OF_RESOURCES;
(VOID **) &mVariableModuleGlobal
);
if (EFI_ERROR (Status)) {
return Status;
} }
EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, EFI_TPL_NOTIFY); EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, EFI_TPL_NOTIFY);
@ -1323,15 +1314,10 @@ Returns:
// //
// Allocate memory for volatile variable store // Allocate memory for volatile variable store
// //
Status = gBS->AllocatePool ( VolatileVariableStore = AllocateRuntimePool (VARIABLE_STORE_SIZE + SCRATCH_SIZE);
EfiRuntimeServicesData, if (VolatileVariableStore == NULL) {
VARIABLE_STORE_SIZE + SCRATCH_SIZE, FreePool (mVariableModuleGlobal);
(VOID **) &VolatileVariableStore return EFI_OUT_OF_RESOURCES;
);
if (EFI_ERROR (Status)) {
gBS->FreePool (mVariableModuleGlobal);
return Status;
} }
SetMem (VolatileVariableStore, VARIABLE_STORE_SIZE + SCRATCH_SIZE, 0xff); SetMem (VolatileVariableStore, VARIABLE_STORE_SIZE + SCRATCH_SIZE, 0xff);
@ -1367,8 +1353,8 @@ Returns:
Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor); Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (mVariableModuleGlobal); FreePool (mVariableModuleGlobal);
gBS->FreePool (VolatileVariableStore); FreePool (VolatileVariableStore);
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -1378,8 +1364,8 @@ Returns:
GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (mVariableModuleGlobal); FreePool (mVariableModuleGlobal);
gBS->FreePool (VolatileVariableStore); FreePool (VolatileVariableStore);
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
// //
@ -1448,8 +1434,8 @@ Returns:
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (mVariableModuleGlobal); FreePool (mVariableModuleGlobal);
gBS->FreePool (VolatileVariableStore); FreePool (VolatileVariableStore);
return Status; return Status;
} }
@ -1473,8 +1459,8 @@ Returns:
} }
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (mVariableModuleGlobal); FreePool (mVariableModuleGlobal);
gBS->FreePool (VolatileVariableStore); FreePool (VolatileVariableStore);
} }
return Status; return Status;

View File

@ -52,6 +52,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword> <Keyword>BaseLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename>Variable.h</Filename> <Filename>Variable.h</Filename>

View File

@ -55,6 +55,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword> <Keyword>BaseLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename>Variable.h</Filename> <Filename>Variable.h</Filename>

View File

@ -1,20 +1,20 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
reclaim.c reclaim.c
Abstract: Abstract:
Handles non-volatile variable store garbage collection, using FTW Handles non-volatile variable store garbage collection, using FTW
(Fault Tolerant Write) protocol. (Fault Tolerant Write) protocol.
@ -82,7 +82,7 @@ GetFvbHandleByAddress (
} }
} }
gBS->FreePool (HandleBuffer); FreePool (HandleBuffer);
return Status; return Status;
} }
@ -216,8 +216,8 @@ Returns:
// Prepare for the variable data // Prepare for the variable data
// //
FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size; FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;
Status = gBS->AllocatePool (EfiRuntimeServicesData, FtwBufferSize, (VOID **) &FtwBuffer); FtwBuffer = AllocateRuntimePool (FtwBufferSize);
if (EFI_ERROR (Status)) { if (FtwBuffer == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
@ -236,6 +236,6 @@ Returns:
FtwBuffer FtwBuffer
); );
gBS->FreePool (FtwBuffer); FreePool (FtwBuffer);
return Status; return Status;
} }