public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check
@ 2017-08-25  2:58 Dandan Bi
  2017-08-28  3:17 ` Dong, Eric
  0 siblings, 1 reply; 2+ messages in thread
From: Dandan Bi @ 2017-08-25  2:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

mLegacyBootOptionPrivate pointer is initialized in Constructor function
with if condition check, but it's used in Destructor function directly
without any check. Now add the NULL pointer check.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c
index 740c95c..a4828b7 100644
--- a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c
+++ b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c
@@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
 
 #include "LegacyBootMaintUi.h"
 
-LEGACY_BOOT_OPTION_CALLBACK_DATA  *mLegacyBootOptionPrivate;
+LEGACY_BOOT_OPTION_CALLBACK_DATA  *mLegacyBootOptionPrivate = NULL;
 EFI_GUID  mLegacyBootOptionGuid     = LEGACY_BOOT_OPTION_FORMSET_GUID;
 CHAR16    mLegacyBootStorageName[]  = L"LegacyBootData";
 BBS_TYPE  mBbsType[] = {BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_NETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN};
 BOOLEAN   mFirstEnterLegacyForm = FALSE;
 
@@ -1484,11 +1484,11 @@ LegacyBootMaintUiLibDestructor (
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS    Status;
 
-  if (mLegacyBootOptionPrivate->DriverHandle != NULL) {
+  if (mLegacyBootOptionPrivate != NULL && mLegacyBootOptionPrivate->DriverHandle != NULL) {
     Status = gBS->UninstallMultipleProtocolInterfaces (
                     mLegacyBootOptionPrivate->DriverHandle,
                     &gEfiDevicePathProtocolGuid,
                     &mLegacyBootOptionHiiVendorDevicePath,
                     &gEfiHiiConfigAccessProtocolGuid,
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-28  3:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25  2:58 [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check Dandan Bi
2017-08-28  3:17 ` Dong, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox