]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
MdeModulePkg DxeCore: Enhance memory profile code to handle possible NULL FilePath.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Mem / MemoryProfileRecord.c
index 60971ba9f9be14801943575b4f507e8886dc9670..1ae991b7024e62e7906fb48738163a470bc0c9b5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for UEFI memory profile.\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -483,13 +483,15 @@ GetFileNameFromFilePath (
   EFI_GUID                              *FileName;\r
 \r
   FileName = NULL;\r
-  ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) FilePath;\r
-  while (!IsDevicePathEnd (ThisFilePath)) {\r
-    FileName = EfiGetNameGuidFromFwVolDevicePathNode (ThisFilePath);\r
-    if (FileName != NULL) {\r
-      break;\r
+  if (FilePath != NULL) {\r
+    ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) FilePath;\r
+    while (!IsDevicePathEnd (ThisFilePath)) {\r
+      FileName = EfiGetNameGuidFromFwVolDevicePathNode (ThisFilePath);\r
+      if (FileName != NULL) {\r
+        break;\r
+      }\r
+      ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) NextDevicePathNode (ThisFilePath);\r
     }\r
-    ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) NextDevicePathNode (ThisFilePath);\r
   }\r
 \r
   return FileName;\r