]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check
authorBi, Dandan <dandan.bi@intel.com>
Fri, 25 Aug 2017 02:58:36 +0000 (10:58 +0800)
committerEric Dong <eric.dong@intel.com>
Mon, 28 Aug 2017 07:13:50 +0000 (15:13 +0800)
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>
Reviewed-by: Eric Dong <eric.dong@intel.com>
IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c

index 740c95ca969f643996e6eced4e6297c2a0a37efa..a4828b7130c73d6ce44338798db418e7d4f64cb1 100644 (file)
@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "LegacyBootMaintUi.h"\r
 \r
-LEGACY_BOOT_OPTION_CALLBACK_DATA  *mLegacyBootOptionPrivate;\r
+LEGACY_BOOT_OPTION_CALLBACK_DATA  *mLegacyBootOptionPrivate = NULL;\r
 EFI_GUID  mLegacyBootOptionGuid     = LEGACY_BOOT_OPTION_FORMSET_GUID;\r
 CHAR16    mLegacyBootStorageName[]  = L"LegacyBootData";\r
 BBS_TYPE  mBbsType[] = {BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_NETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN};\r
@@ -1486,7 +1486,7 @@ LegacyBootMaintUiLibDestructor (
 {\r
   EFI_STATUS    Status;\r
 \r
-  if (mLegacyBootOptionPrivate->DriverHandle != NULL) {\r
+  if (mLegacyBootOptionPrivate != NULL && mLegacyBootOptionPrivate->DriverHandle != NULL) {\r
     Status = gBS->UninstallMultipleProtocolInterfaces (\r
                     mLegacyBootOptionPrivate->DriverHandle,\r
                     &gEfiDevicePathProtocolGuid,\r