summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-09 15:29:35 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-09 15:29:35 +0000
commitb148591a8ce071b686aaadad398d599685f33487 (patch)
tree5c6e97fe9d718e2251134e5a34a5127de3770d2d /ArmPlatformPkg
parent3d565dd6740ba4ca7428811589484c5baef0db8a (diff)
downloadedk2-platforms-b148591a8ce071b686aaadad398d599685f33487.tar.xz
ArmPlatformPkg/Bds: Fixed memory leak
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12997 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/Bds/Bds.c14
-rw-r--r--ArmPlatformPkg/Bds/BootOption.c13
2 files changed, 25 insertions, 2 deletions
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
index 176311e8a2..8f7f9fdf7c 100644
--- a/ArmPlatformPkg/Bds/Bds.c
+++ b/ArmPlatformPkg/Bds/Bds.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
@@ -196,6 +196,17 @@ InitializeConsole (
gST->StdErr = gST->ConOut;
}
+ // Free Memory allocated for reading the UEFI Variables
+ if (ConOutDevicePaths) {
+ FreePool (ConOutDevicePaths);
+ }
+ if (ConInDevicePaths) {
+ FreePool (ConInDevicePaths);
+ }
+ if (ConErrDevicePaths) {
+ FreePool (ConErrDevicePaths);
+ }
+
return EFI_SUCCESS;
}
@@ -344,6 +355,7 @@ StartDefaultBootOnTimeout (
}
// In case of success, we should not return from this call.
}
+ FreePool (BootOrder);
}
}
return EFI_SUCCESS;
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c
index d811c03ccc..3710178a43 100644
--- a/ArmPlatformPkg/Bds/BootOption.c
+++ b/ArmPlatformPkg/Bds/BootOption.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
*
* This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License
@@ -82,6 +82,8 @@ BootOptionStart (
Initrd, // Initrd
(CHAR8*)(LinuxArguments + 1),
FdtDevicePath);
+
+ FreePool (FdtDevicePath);
}
} else {
Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);
@@ -119,6 +121,8 @@ BootOptionList (
}
}
+ FreePool (BootOrder);
+
return EFI_SUCCESS;
}
@@ -290,6 +294,11 @@ BootOptionCreate (
BootOrder
);
+ // We only free it if the UEFI Variable 'BootOrder' was already existing
+ if (BootOrderSize > sizeof(UINT16)) {
+ FreePool (BootOrder);
+ }
+
*BdsLoadOption = BootOption;
return Status;
}
@@ -361,5 +370,7 @@ BootOptionDelete (
);
}
+ FreePool (BootOrder);
+
return EFI_SUCCESS;
}