]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiMisc.c
NetworkPkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiMisc.c
index 9e4164c986bc58af794de0a93b168614ed4cf74a..94f3725866611763c70d557348e377a482a44e0d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Miscellaneous routines for iSCSI driver.\r
 \r
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2018, 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
@@ -1798,8 +1798,9 @@ IScsiCleanDriverData (
   }\r
 \r
 EXIT:\r
-\r
-  gBS->CloseEvent (Private->ExitBootServiceEvent);\r
+  if (Private->ExitBootServiceEvent != NULL) {\r
+    gBS->CloseEvent (Private->ExitBootServiceEvent); \r
+  }\r
 \r
   mCallbackInfo->Current = NULL;\r
 \r
@@ -2485,8 +2486,10 @@ IScsiOnExitBootService (
   ISCSI_DRIVER_DATA *Private;\r
 \r
   Private = (ISCSI_DRIVER_DATA *) Context;\r
+  \r
   gBS->CloseEvent (Private->ExitBootServiceEvent);\r
-\r
+  Private->ExitBootServiceEvent = NULL;\r
+  \r
   if (Private->Session != NULL) {\r
     IScsiSessionAbort (Private->Session);\r
   }\r