]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PlatVarCleanupLib: Add lib destructor for unclosed event
authorHao Wu <hao.a.wu@intel.com>
Fri, 10 Mar 2017 05:57:39 +0000 (13:57 +0800)
committerHao Wu <hao.a.wu@intel.com>
Mon, 13 Mar 2017 01:15:40 +0000 (09:15 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c
MdeModulePkg/Library/PlatformVarCleanupLib/PlatformVarCleanupLib.inf

index b96f8ddd831f7254188e2b03a3e4323ef90959f7..c5fd30e2196b2fef3639d46abb2133739b518020 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Sample platform variable cleanup library implementation.\r
 \r
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, 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
@@ -22,6 +22,8 @@ EDKII_VAR_CHECK_PROTOCOL    *mVarCheck = NULL;
 ///\r
 BOOLEAN                     mEndOfDxe = FALSE;\r
 \r
+EFI_EVENT                   mPlatVarCleanupLibEndOfDxeEvent = NULL;\r
+\r
 LIST_ENTRY                  mUserVariableList = INITIALIZE_LIST_HEAD_VARIABLE (mUserVariableList);\r
 UINT16                      mUserVariableCount = 0;\r
 UINT16                      mMarkedUserVariableCount = 0;\r
@@ -1229,7 +1231,6 @@ PlatformVarCleanupLibConstructor (
   )\r
 {\r
   EFI_STATUS    Status;\r
-  EFI_EVENT     Event;\r
 \r
   mLastVarErrorFlag = InternalGetVarErrorFlag ();\r
   DEBUG ((EFI_D_INFO, "mLastVarErrorFlag - 0x%02x\n", mLastVarErrorFlag));\r
@@ -1243,10 +1244,36 @@ PlatformVarCleanupLibConstructor (
                   PlatformVarCleanupEndOfDxeEvent,\r
                   NULL,\r
                   &gEfiEndOfDxeEventGroupGuid,\r
-                  &Event\r
+                  &mPlatVarCleanupLibEndOfDxeEvent\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  The destructor function closes the End of DXE event.\r
+\r
+  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param  SystemTable   A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS   The destructor completed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformVarCleanupLibDestructor (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+\r
+  //\r
+  // Close the End of DXE event.\r
+  //\r
+  Status = gBS->CloseEvent (mPlatVarCleanupLibEndOfDxeEvent);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
index a3498cca507330e07ab28eea95ed29ba0687106e..6e7fcb6a5c0c5f884666d7f03944dc17dc3cc7b3 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  Sample platform variable cleanup library instance.\r
 #\r
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions\r
@@ -23,6 +23,7 @@
   VERSION_STRING                = 1.0\r
   LIBRARY_CLASS                 = PlatformVarCleanupLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER\r
   CONSTRUCTOR                   = PlatformVarCleanupLibConstructor\r
+  DESTRUCTOR                    = PlatformVarCleanupLibDestructor\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r