]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
Update HiiGetBrowserData API
[mirror_edk2.git] / MdeModulePkg / Universal / DriverSampleDxe / DriverSample.c
index 8a46972f7d232dc8317104b9fbb8e7cd4cebc01a..0e8efd18d07eb17f6b821e0154d96d54887493fd 100644 (file)
@@ -260,8 +260,9 @@ SetPassword (
   //\r
   // Retrive uncommitted data from Browser\r
   //\r
-  Configuration = (DRIVER_SAMPLE_CONFIGURATION *) HiiGetBrowserData (&mFormSetGuid, VariableName, sizeof (DRIVER_SAMPLE_CONFIGURATION));\r
-  if (Configuration != NULL) {\r
+  Configuration = AllocateZeroPool (sizeof (DRIVER_SAMPLE_CONFIGURATION));\r
+  ASSERT (Configuration != NULL);\r
+  if (HiiGetBrowserData (&mFormSetGuid, VariableName, sizeof (DRIVER_SAMPLE_CONFIGURATION), (UINT8 *) Configuration)) {\r
     //\r
     // Update password's clear text in the screen\r
     //\r
@@ -277,10 +278,13 @@ SetPassword (
        (UINT8 *) Configuration,\r
        NULL\r
        );\r
-    \r
-    FreePool (Configuration);\r
   }\r
 \r
+  //\r
+  // Free Configuration Buffer\r
+  //\r
+  FreePool (Configuration);\r
+\r
 \r
   //\r
   // Set password\r