MdeModulePkg DxeCore: Enhance memory profile code to handle possible NULL FilePath.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16595 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2015-01-09 08:46:47 +00:00 committed by lzeng14
parent a5077fd0d2
commit 092b852a5b
1 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Support routines for UEFI memory profile. Support routines for UEFI memory profile.
Copyright (c) 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -483,13 +483,15 @@ GetFileNameFromFilePath (
EFI_GUID *FileName; EFI_GUID *FileName;
FileName = NULL; FileName = NULL;
ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) FilePath; if (FilePath != NULL) {
while (!IsDevicePathEnd (ThisFilePath)) { ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) FilePath;
FileName = EfiGetNameGuidFromFwVolDevicePathNode (ThisFilePath); while (!IsDevicePathEnd (ThisFilePath)) {
if (FileName != NULL) { FileName = EfiGetNameGuidFromFwVolDevicePathNode (ThisFilePath);
break; if (FileName != NULL) {
break;
}
ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) NextDevicePathNode (ThisFilePath);
} }
ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) NextDevicePathNode (ThisFilePath);
} }
return FileName; return FileName;