summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/DnsDxe
diff options
context:
space:
mode:
authorJiaxin Wu <Jiaxin.wu@intel.com>2019-01-16 10:56:19 +0800
committerJiaxin Wu <Jiaxin.wu@intel.com>2019-01-23 08:46:50 +0800
commit62a623debd9f7d40823ac1851939f6ee9255382c (patch)
treef8e0d2b2f41959605677a5ee3572cffed3e5dcf1 /NetworkPkg/DnsDxe
parentaf82ca4560a5c2ef4286bad767cab3cfe7c115dd (diff)
downloadedk2-62a623debd9f7d40823ac1851939f6ee9255382c.tar.gz
edk2-62a623debd9f7d40823ac1851939f6ee9255382c.tar.bz2
edk2-62a623debd9f7d40823ac1851939f6ee9255382c.zip
NetworkPkg/DnsDxe: Remove unnecessary NULL pointer check.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469 Since the value of ItemCache4/ItemCache6 is retrieved from the list Entry, it can't be the NULL pointer, so just remove the unnecessary check. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Hao A <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Wu Hao A <hao.a.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg/DnsDxe')
-rw-r--r--NetworkPkg/DnsDxe/DnsDriver.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriver.c
index b74f5ba18e..6a4214caea 100644
--- a/NetworkPkg/DnsDxe/DnsDriver.c
+++ b/NetworkPkg/DnsDxe/DnsDriver.c
@@ -1,7 +1,7 @@
/** @file
The driver binding and service binding protocol for DnsDxe driver.
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -376,36 +376,32 @@ DnsUnload (
while (!IsListEmpty (&mDriverData->Dns4CacheList)) {
Entry = NetListRemoveHead (&mDriverData->Dns4CacheList);
+ ASSERT (Entry != NULL);
ItemCache4 = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
- if (ItemCache4->DnsCache.HostName != NULL) {
- FreePool (ItemCache4->DnsCache.HostName);
- }
- if (ItemCache4->DnsCache.IpAddress != NULL) {
- FreePool (ItemCache4->DnsCache.IpAddress);
- }
+ FreePool (ItemCache4->DnsCache.HostName);
+ FreePool (ItemCache4->DnsCache.IpAddress);
FreePool (ItemCache4);
}
while (!IsListEmpty (&mDriverData->Dns4ServerList)) {
Entry = NetListRemoveHead (&mDriverData->Dns4ServerList);
+ ASSERT (Entry != NULL);
ItemServerIp4 = NET_LIST_USER_STRUCT (Entry, DNS4_SERVER_IP, AllServerLink);
FreePool (ItemServerIp4);
}
while (!IsListEmpty (&mDriverData->Dns6CacheList)) {
Entry = NetListRemoveHead (&mDriverData->Dns6CacheList);
+ ASSERT (Entry != NULL);
ItemCache6 = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
- if (ItemCache6->DnsCache.HostName != NULL) {
- FreePool (ItemCache6->DnsCache.HostName);
- }
- if (ItemCache6->DnsCache.IpAddress != NULL) {
- FreePool (ItemCache6->DnsCache.IpAddress);
- }
+ FreePool (ItemCache6->DnsCache.HostName);
+ FreePool (ItemCache6->DnsCache.IpAddress);
FreePool (ItemCache6);
}
while (!IsListEmpty (&mDriverData->Dns6ServerList)) {
Entry = NetListRemoveHead (&mDriverData->Dns6ServerList);
+ ASSERT (Entry != NULL);
ItemServerIp6 = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, AllServerLink);
FreePool (ItemServerIp6);
}