From cfd79783d603bb2db98ffa0a370bea572724d51c Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 25 May 2016 13:11:17 +0800 Subject: MdeModulePkg DxeS3BootScriptLib: Add DESTRUCTOR S3BootScriptLibDeinitialize PiDxeS3BootScriptLib has a constructor S3BootScriptLibInitialize() that registers ready-to-lock callback S3BootScriptSmmEventCallBack() and several more. The library is linked to SMM modules. If the module entry-point function returns error (because of lack of resources, unsupported, whatever), the module will be unloaded and the notify callback pointers will point to undefined memory. On ready-to-lock exception occurs when calling S3BootScriptSmmEventCallBack(), and probably all the other callbacks registered by the constructor would also cause exception. This patch is to implement library Destructor to free the resources allocated by S3BootScriptLibInitialize() and unregister callbacks. Cc: Jiewen Yao Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao Reviewed-by: Laszlo Ersek Tested-by: Laszlo Ersek --- MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf') diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf b/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf index 4e0919ea2c..0f4151180f 100644 --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf @@ -1,7 +1,7 @@ ## @file # DXE S3 boot script Library. # -# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are # licensed and made available under the terms and conditions of the BSD License @@ -24,6 +24,7 @@ CONSTRUCTOR = S3BootScriptLibInitialize + DESTRUCTOR = S3BootScriptLibDeinitialize # # The following information is for reference only and not required by the build tools. -- cgit v1.2.3