]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
MdeModulePkg/Ip4Dxe: Fix the potential NULL pointer free
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Config2Impl.c
index 88ead9d26949cd2ec8d835680e8afff489621237..131b03f7711beda89be489fd2941bd4663853162 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of EFI IPv4 Configuration II Protocol.\r
 \r
 /** @file\r
   The implementation of EFI IPv4 Configuration II Protocol.\r
 \r
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
@@ -741,13 +741,17 @@ Ip4Config2SetDnsServerWorker (
       //\r
       // The dns server address must be unicast.\r
       //\r
       //\r
       // The dns server address must be unicast.\r
       //\r
-      FreePool (Tmp);\r
+      if (Tmp != NULL) {\r
+        FreePool (Tmp);\r
+      }\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
     for (Index1 = NewIndex + 1; Index1 < NewDnsCount; Index1++) {\r
       if (EFI_IP4_EQUAL (NewDns + NewIndex, NewDns + Index1)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
     for (Index1 = NewIndex + 1; Index1 < NewDnsCount; Index1++) {\r
       if (EFI_IP4_EQUAL (NewDns + NewIndex, NewDns + Index1)) {\r
-        FreePool (Tmp);\r
+        if (Tmp != NULL) {\r
+          FreePool (Tmp);\r
+        }\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r