]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
MdeModulePkg: Fix IPv4 double free
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Config2Impl.c
index 1f763b6bfe0df8a62f91ffd7bcac2c376a552a76..17e0247832200cbf3fe7504ab762544cff18b5d4 100644 (file)
@@ -2,7 +2,7 @@
   The implementation of EFI IPv4 Configuration II Protocol.\r
 \r
   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
   The implementation of EFI IPv4 Configuration II Protocol.\r
 \r
   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
-  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -1194,6 +1194,7 @@ Ip4Config2SetPolicy (
       //\r
       if (Instance->Dhcp4Event != NULL) {\r
         gBS->CloseEvent (Instance->Dhcp4Event);\r
       //\r
       if (Instance->Dhcp4Event != NULL) {\r
         gBS->CloseEvent (Instance->Dhcp4Event);\r
+        Instance->Dhcp4Event = NULL;\r
       }\r
     }\r
   }\r
       }\r
     }\r
   }\r
@@ -1997,6 +1998,7 @@ Ip4Config2CleanInstance (
   //\r
   if (Instance->Dhcp4Event != NULL) {\r
     gBS->CloseEvent (Instance->Dhcp4Event);\r
   //\r
   if (Instance->Dhcp4Event != NULL) {\r
     gBS->CloseEvent (Instance->Dhcp4Event);\r
+    Instance->Dhcp4Event = NULL;\r
   }\r
 \r
   for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {\r
   }\r
 \r
   for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {\r