summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Bds/BootMenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/Bds/BootMenu.c')
-rw-r--r--ArmPlatformPkg/Bds/BootMenu.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index e7e475dfc1..ecd1d60f40 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -354,7 +354,8 @@ BootMenuUpdateBootOption (
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
- EFI_DEVICE_PATH* DevicePath;
+ EFI_DEVICE_PATH *DevicePath;
+ EFI_DEVICE_PATH *TempInitrdPath;
ARM_BDS_LOADER_TYPE BootType;
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
@@ -423,11 +424,13 @@ BootMenuUpdateBootOption (
if (InitrdPathNode != NULL) {
// Duplicate Linux kernel Device Path
- DevicePath = DuplicateDevicePath (BootOption->FilePathList);
+ TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
// Replace Linux kernel Node by EndNode
- SetDevicePathEndNode (GetLastDevicePathNode (DevicePath));
+ SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
// Append the Device Path node to the select device path
- InitrdPath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ InitrdPath = AppendDevicePathNode (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ FreePool (TempInitrdPath);
+ InitrdSize = GetDevicePathSize (InitrdPath);
} else {
InitrdPath = NULL;
}