summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-18 05:03:45 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-18 05:03:45 +0000
commit04da0b4a11fd128c08fb0192c02a142285f6fa69 (patch)
tree55140ccf24e3e3f311cef7bd6389261664b699f7 /MdeModulePkg
parentd6e11f223065ed83ce38e84a9a00e20dfa37bc2d (diff)
downloadedk2-04da0b4a11fd128c08fb0192c02a142285f6fa69.tar.gz
edk2-04da0b4a11fd128c08fb0192c02a142285f6fa69.tar.bz2
edk2-04da0b4a11fd128c08fb0192c02a142285f6fa69.zip
Correct DriverSample to produce the ConfigAccess protocol
And fix the bug in HiiDataBase to incorrectly free pool. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8321 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c45
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c6
2 files changed, 35 insertions, 16 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 39e72909da..784cd28d7a 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -362,13 +362,16 @@ ExtractConfig (
// Try to get the current setting from variable.
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
- gRT->GetVariable (
- VariableName,
- &mFormSetGuid,
- NULL,
- &BufferSize,
- &PrivateData->Configuration
- );
+ Status = gRT->GetVariable (
+ VariableName,
+ &mFormSetGuid,
+ NULL,
+ &BufferSize,
+ &PrivateData->Configuration
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
if (Request == NULL) {
//
@@ -476,13 +479,16 @@ RouteConfig (
// Get Buffer Storage data from EFI variable
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
- gRT->GetVariable (
- VariableName,
- &mFormSetGuid,
- NULL,
- &BufferSize,
- &PrivateData->Configuration
- );
+ Status = gRT->GetVariable (
+ VariableName,
+ &mFormSetGuid,
+ NULL,
+ &BufferSize,
+ &PrivateData->Configuration
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
//
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
@@ -969,6 +975,17 @@ DriverSampleInit (
Status = gRT->GetVariable (VariableName, &mFormSetGuid, NULL, &BufferSize, Configuration);
if (EFI_ERROR (Status)) {
//
+ // Store zero data Buffer Storage to EFI variable
+ //
+ Status = gRT->SetVariable(
+ VariableName,
+ &mFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (DRIVER_SAMPLE_CONFIGURATION),
+ Configuration
+ );
+ ASSERT (Status == EFI_SUCCESS);
+ //
// EFI variable for NV config doesn't exit, we should build this variable
// based on default values stored in IFR
//
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index fe03596971..2f5118e512 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -873,9 +873,9 @@ ParseIfrData (
LengthString = StrLen (GuidStr);
LengthString = LengthString + StrLen (NameStr) + 1;
TempStr = AllocateZeroPool (LengthString * sizeof (CHAR16));
- FreePool (GuidStr);
- FreePool (NameStr);
if (TempStr == NULL) {
+ FreePool (GuidStr);
+ FreePool (NameStr);
FreePool (VarStoreName);
Status = EFI_OUT_OF_RESOURCES;
goto Done;
@@ -899,6 +899,8 @@ ParseIfrData (
//
// Free alllocated temp string.
//
+ FreePool (GuidStr);
+ FreePool (NameStr);
FreePool (TempStr);
break;