]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/DnsDxe/DnsDriver.c
NetworkPkg/DnsDxe: Remove unnecessary NULL pointer check.
[mirror_edk2.git] / NetworkPkg / DnsDxe / DnsDriver.c
index b74f5ba18e8235f151f720fa9fb2e51819094600..6a4214caea1f8efb68f9cfc6e7016b108f562da7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 The driver binding and service binding protocol for DnsDxe driver.\r
 \r
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2019, 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
@@ -376,36 +376,32 @@ DnsUnload (
 \r
     while (!IsListEmpty (&mDriverData->Dns4CacheList)) {\r
       Entry = NetListRemoveHead (&mDriverData->Dns4CacheList);\r
+      ASSERT (Entry != NULL);\r
       ItemCache4 = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);\r
-      if (ItemCache4->DnsCache.HostName != NULL) {\r
-        FreePool (ItemCache4->DnsCache.HostName);\r
-      }\r
-      if (ItemCache4->DnsCache.IpAddress != NULL) {\r
-        FreePool (ItemCache4->DnsCache.IpAddress);\r
-      }\r
+      FreePool (ItemCache4->DnsCache.HostName);\r
+      FreePool (ItemCache4->DnsCache.IpAddress);\r
       FreePool (ItemCache4);\r
     }\r
 \r
     while (!IsListEmpty (&mDriverData->Dns4ServerList)) {\r
       Entry = NetListRemoveHead (&mDriverData->Dns4ServerList);\r
+      ASSERT (Entry != NULL);\r
       ItemServerIp4 = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, AllServerLink);\r
       FreePool (ItemServerIp4);\r
     }\r
 \r
     while (!IsListEmpty (&mDriverData->Dns6CacheList)) {\r
       Entry = NetListRemoveHead (&mDriverData->Dns6CacheList);\r
+      ASSERT (Entry != NULL);\r
       ItemCache6 = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);\r
-      if (ItemCache6->DnsCache.HostName != NULL) {\r
-        FreePool (ItemCache6->DnsCache.HostName);\r
-      }\r
-      if (ItemCache6->DnsCache.IpAddress != NULL) {\r
-        FreePool (ItemCache6->DnsCache.IpAddress);\r
-      }\r
+      FreePool (ItemCache6->DnsCache.HostName);\r
+      FreePool (ItemCache6->DnsCache.IpAddress);\r
       FreePool (ItemCache6);\r
     }\r
 \r
     while (!IsListEmpty (&mDriverData->Dns6ServerList)) {\r
       Entry = NetListRemoveHead (&mDriverData->Dns6ServerList);\r
+      ASSERT (Entry != NULL);\r
       ItemServerIp6 = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, AllServerLink);\r
       FreePool (ItemServerIp6);\r
     }\r