summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
diff options
context:
space:
mode:
authorXu, Wei6 <wei6.xu@intel.com>2019-07-26 11:10:53 +0800
committerLiming Gao <liming.gao@intel.com>2019-07-29 11:01:37 +0800
commite92bdcb3ecbf73b3a56378c1f6e054335215d939 (patch)
treee97329ae707a45880200de046498614efed22297 /MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
parent87ad6913b4dbeb0a49c6edc997e845e63840e4c2 (diff)
downloadedk2-e92bdcb3ecbf73b3a56378c1f6e054335215d939.tar.gz
edk2-e92bdcb3ecbf73b3a56378c1f6e054335215d939.tar.bz2
edk2-e92bdcb3ecbf73b3a56378c1f6e054335215d939.zip
MdePkg/UefiDebugLibConOut: Add destructor to CloseEvent
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2012 When driver is unloaded, the ExitBootSerivesEvent must be closed at the same time. Otherwise exception will occur when ExitBootServices. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c')
-rw-r--r--MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
index 8005370372..ed73f92818 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
@@ -75,3 +75,26 @@ DxeDebugLibConstructor(
return EFI_SUCCESS;
}
+
+/**
+ The destructor closes Exit Boot Services Event.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeDebugLibDestructor(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ if (mExitBootServicesEvent != NULL) {
+ SystemTable->BootServices->CloseEvent (mExitBootServicesEvent);
+ }
+
+ return EFI_SUCCESS;
+}