diff options
author | Thomas Palmer <thomas.palmer@hpe.com> | 2016-03-31 01:16:48 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-03-31 09:21:05 +0800 |
commit | 065e587c179d17eabe38ef743cf3fd95a5a492a0 (patch) | |
tree | 665490e924fce14d9b8f795f924dce2e76d4a31a /MdeModulePkg | |
parent | 7361d3ff88e51a82282d86f268d83366f79a5075 (diff) | |
download | edk2-065e587c179d17eabe38ef743cf3fd95a5a492a0.zip edk2-065e587c179d17eabe38ef743cf3fd95a5a492a0.tar.gz edk2-065e587c179d17eabe38ef743cf3fd95a5a492a0.tar.bz2 |
MdeModulePkg/UefiBootManagerLib: BmGetActiveConsoleIn code cleanup
Check for NULL from AllocateCopyPool before setting Count to 1. Also
change sizeof (EFI_HANDLE*) to sizeof (EFI_HANDLE). Handles is a
EFI_HANDLE pointer, so the allocated memory must be the size of
EFI_HANDLE.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c index b49758b..55df7e9 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c @@ -2,6 +2,7 @@ Hotkey library functions.
Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -471,8 +472,10 @@ BmGetActiveConsoleIn ( EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (!EFI_ERROR (Status)) {
- Handles = AllocateCopyPool (sizeof (EFI_HANDLE *), &gST->ConsoleInHandle);
- *Count = 1;
+ Handles = AllocateCopyPool (sizeof (EFI_HANDLE), &gST->ConsoleInHandle);
+ if (Handles != NULL) {
+ *Count = 1;
+ }
}
} else {
Status = gBS->LocateHandleBuffer (
|