X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Nt32Pkg%2FPlatformBdsDxe%2FGeneric%2FFrontPage.c;h=6df4d86426cce5ff24db0a80cfce5646eebe440b;hp=93b27c5ed42574c533ac9844fd8cb2c2ce167b4e;hb=6bfce83ac45f2cb829178c619ee6907d640cc847;hpb=40f18da12b2f04f42cae34a7f33db6a595f4dcd7 diff --git a/Nt32Pkg/PlatformBdsDxe/Generic/FrontPage.c b/Nt32Pkg/PlatformBdsDxe/Generic/FrontPage.c index 93b27c5ed4..6df4d86426 100644 --- a/Nt32Pkg/PlatformBdsDxe/Generic/FrontPage.c +++ b/Nt32Pkg/PlatformBdsDxe/Generic/FrontPage.c @@ -332,17 +332,6 @@ ReInitStrings: OptionCount = 0; - // - // Try for a 512 byte Buffer - // - BufferSize = 0x200; - - // - // Allocate memory for our Form binary - // - StringBuffer = AllocateZeroPool (BufferSize); - ASSERT (StringBuffer != NULL); - for (Index = 0; LanguageString[Index] != 0; Index += 3) { Token = 0; CopyMem (Lang, &LanguageString[Index], 6); @@ -352,8 +341,14 @@ ReInitStrings: mLastSelection = (UINT16) OptionCount; } + BufferSize = 0; + Status = gHii->GetString (gHii, gStringPackHandle, 1, TRUE, Lang, &BufferSize, NULL); + ASSERT(Status == EFI_BUFFER_TOO_SMALL); + StringBuffer = AllocateZeroPool (BufferSize); + ASSERT (StringBuffer != NULL); Status = gHii->GetString (gHii, gStringPackHandle, 1, TRUE, Lang, &BufferSize, StringBuffer); gHii->NewString (gHii, NULL, gStringPackHandle, &Token, StringBuffer); + FreePool (StringBuffer); CopyMem (&OptionList[OptionCount].StringToken, &Token, sizeof (UINT16)); CopyMem (&OptionList[OptionCount].Value, &OptionCount, sizeof (UINT16)); Key = 0x1234; @@ -365,7 +360,6 @@ ReInitStrings: FreePool (LanguageString); if (ReInitializeStrings) { - FreePool (StringBuffer); FreePool (OptionList); return EFI_SUCCESS; } @@ -391,7 +385,6 @@ ReInitStrings: // // FreePool (OptionList); // - FreePool (StringBuffer); return Status; }