]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EdkCompatibilityPkg SmmBaseHelper: Unregister profile image correctly.
authorStar Zeng <star.zeng@intel.com>
Tue, 9 Jun 2015 09:42:15 +0000 (09:42 +0000)
committerlzeng14 <lzeng14@Edk2>
Tue, 9 Jun 2015 09:42:15 +0000 (09:42 +0000)
Call UnregisterSmramProfileImage() before image buffer freed.

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@17599 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c

index 2b94e4d877dcb79e18f05f7db926a73b2aa8d7f5..1d1644923da1e994923d7821f7c7c30766f27969 100644 (file)
@@ -11,7 +11,7 @@
 \r
   SmmHandlerEntry() will receive untrusted input and do validation.\r
 \r
 \r
   SmmHandlerEntry() will receive untrusted input and do validation.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 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
   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
@@ -34,7 +34,6 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/SynchronizationLib.h>\r
 #include <Library/CpuLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/SynchronizationLib.h>\r
 #include <Library/CpuLib.h>\r
-#include <Library/PcdLib.h>\r
 #include <Guid/SmmBaseThunkCommunication.h>\r
 #include <Protocol/SmmBaseHelperReady.h>\r
 #include <Protocol/SmmCpu.h>\r
 #include <Guid/SmmBaseThunkCommunication.h>\r
 #include <Protocol/SmmBaseHelperReady.h>\r
 #include <Protocol/SmmCpu.h>\r
@@ -734,10 +733,10 @@ LoadImage (
     RegisterSmramProfileImage (FilePath, DstBuffer, PageCount);\r
     Status = gBS->StartImage (*ImageHandle, NULL, NULL);\r
     if (EFI_ERROR (Status)) {\r
     RegisterSmramProfileImage (FilePath, DstBuffer, PageCount);\r
     Status = gBS->StartImage (*ImageHandle, NULL, NULL);\r
     if (EFI_ERROR (Status)) {\r
+      UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);\r
       mLoadPe32Image->UnLoadPeImage (mLoadPe32Image, *ImageHandle);\r
       *ImageHandle = NULL;\r
       FreePages ((VOID *)(UINTN)DstBuffer, PageCount);\r
       mLoadPe32Image->UnLoadPeImage (mLoadPe32Image, *ImageHandle);\r
       *ImageHandle = NULL;\r
       FreePages ((VOID *)(UINTN)DstBuffer, PageCount);\r
-      UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
index 84eba482f453c9889ab52c3ac402fcedfcde1413..a1797eaa6033862d6ff17f6eb51f98ab13a6ab52 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\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
   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
@@ -20,6 +20,7 @@
 #include <Library/DevicePathLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
 #include <Protocol/SmmCommunication.h>\r
 \r
 #include <Guid/MemoryProfile.h>\r
 #include <Protocol/SmmCommunication.h>\r
 \r
 #include <Guid/MemoryProfile.h>\r