NetworkPkg: Enhance the code in DNS driver.

There may be an error happens when we use the
configure function to set or change the configuration
data for the DNS6 instance, So we will free the
DnsServerList without configured to NULL. If we reset
the instance with the parameter DnsConfigData to NULL, the
DnsServerList will be freed twice.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c
index 64fca6a..6d117b2 100644
--- a/NetworkPkg/DnsDxe/DnsProtocol.c
+++ b/NetworkPkg/DnsDxe/DnsProtocol.c
@@ -287,6 +287,7 @@
     if (EFI_ERROR (Status)) {

       if (Instance->Dns4CfgData.DnsServerList != NULL) {

         FreePool (Instance->Dns4CfgData.DnsServerList);

+        Instance->Dns4CfgData.DnsServerList = NULL;

       }

       goto ON_EXIT;

     }

@@ -298,6 +299,7 @@
     if (EFI_ERROR (Status)) {

       if (Instance->Dns4CfgData.DnsServerList != NULL) {

         FreePool (Instance->Dns4CfgData.DnsServerList);

+        Instance->Dns4CfgData.DnsServerList = NULL;

       }

       goto ON_EXIT;

     }

@@ -1108,6 +1110,7 @@
     if (EFI_ERROR (Status)) {

       if (Instance->Dns6CfgData.DnsServerList != NULL) {

         FreePool (Instance->Dns6CfgData.DnsServerList);

+        Instance->Dns6CfgData.DnsServerList = NULL;

       }

       goto ON_EXIT;

     }

@@ -1119,6 +1122,7 @@
     if (EFI_ERROR (Status)) {

       if (Instance->Dns6CfgData.DnsServerList != NULL) {

         FreePool (Instance->Dns6CfgData.DnsServerList);

+        Instance->Dns6CfgData.DnsServerList = NULL;

       }

       goto ON_EXIT;

     }