diff options
author | Bi, Dandan <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Bi, Dandan08b> | 2016-07-05 16:53:11 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-06 16:23:02 +0800 |
commit | a91f1a0e88d07dd3817737f9886bc247cc737a4f (patch) | |
tree | be5a968ec9c61d5c570707f402528b06e9283fbb /MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c | |
parent | ae9026ddfa063f23ba3c7c57e3d5d6c9e0de8220 (diff) | |
download | edk2-platforms-a91f1a0e88d07dd3817737f9886bc247cc737a4f.tar.xz |
MdeModulePkg/BootMaintUi: Add error handling codes when AllocatePool fail
The AllocateCopyPool in function ExtractFileNameFromDevicePath
may return NULL, so need to do error handling. This patch is to
add error handling codes for function ExtractFileNameFromDevicePath
and its caller functions.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c')
-rw-r--r-- | MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c index 13a29db9f4..9e79826a6a 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c @@ -1,7 +1,7 @@ /** @file
Dynamically update the pages.
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<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
@@ -1020,17 +1020,19 @@ UpdateOptionPage( CHAR16 *String;
EFI_STRING_ID StringToken;
+ String = NULL;
+
if (DevicePath != NULL){
String = ExtractFileNameFromDevicePath(DevicePath);
- StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
- FreePool(String);
- } else {
+ }
+ if (String == NULL) {
String = HiiGetString (CallbackData->BmmHiiHandle, STRING_TOKEN (STR_NULL_STRING), NULL);
ASSERT (String != NULL);
- StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
- FreePool (String);
}
+ StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
+ FreePool (String);
+
if(FormId == FORM_BOOT_ADD_ID){
if (!CallbackData->BmmFakeNvData.BootOptionChanged) {
ZeroMem (CallbackData->BmmFakeNvData.BootOptionalData, sizeof (CallbackData->BmmFakeNvData.BootOptionalData));
|