public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Zhang Lubo <lubo.zhang@intel.com>
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>, Fu Siyuan <siyuan.fu@intel.com>,
	Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [patch] NetworkPkg: Enhance the code in DNS driver.
Date: Fri, 14 Oct 2016 14:54:21 +0800	[thread overview]
Message-ID: <1476428061-23960-1-git-send-email-lubo.zhang@intel.com> (raw)

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>
---
 NetworkPkg/DnsDxe/DnsProtocol.c | 4 ++++
 1 file changed, 4 insertions(+)

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
@@ -285,10 +285,11 @@ Dns4Configure (
     //
     Status = Dns4ConfigUdp (Instance, Instance->UdpIo);
     if (EFI_ERROR (Status)) {
       if (Instance->Dns4CfgData.DnsServerList != NULL) {
         FreePool (Instance->Dns4CfgData.DnsServerList);
+        Instance->Dns4CfgData.DnsServerList = NULL;
       }
       goto ON_EXIT;
     }
 
     //
@@ -296,10 +297,11 @@ Dns4Configure (
     //
     Status = AddDns4ServerIp (&mDriverData->Dns4ServerList, Instance->SessionDnsServer.v4);
     if (EFI_ERROR (Status)) {
       if (Instance->Dns4CfgData.DnsServerList != NULL) {
         FreePool (Instance->Dns4CfgData.DnsServerList);
+        Instance->Dns4CfgData.DnsServerList = NULL;
       }
       goto ON_EXIT;
     }
     
     Instance->State = DNS_STATE_CONFIGED;
@@ -1106,10 +1108,11 @@ Dns6Configure (
     //
     Status = Dns6ConfigUdp (Instance, Instance->UdpIo);
     if (EFI_ERROR (Status)) {
       if (Instance->Dns6CfgData.DnsServerList != NULL) {
         FreePool (Instance->Dns6CfgData.DnsServerList);
+        Instance->Dns6CfgData.DnsServerList = NULL;
       }
       goto ON_EXIT;
     }
 
     //
@@ -1117,10 +1120,11 @@ Dns6Configure (
     //
     Status = AddDns6ServerIp (&mDriverData->Dns6ServerList, Instance->SessionDnsServer.v6);
     if (EFI_ERROR (Status)) {
       if (Instance->Dns6CfgData.DnsServerList != NULL) {
         FreePool (Instance->Dns6CfgData.DnsServerList);
+        Instance->Dns6CfgData.DnsServerList = NULL;
       }
       goto ON_EXIT;
     }
     
     Instance->State = DNS_STATE_CONFIGED;
-- 
1.9.5.msysgit.1



             reply	other threads:[~2016-10-14  6:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14  6:54 Zhang Lubo [this message]
2016-10-14 12:12 ` [patch] NetworkPkg: Enhance the code in DNS driver Laszlo Ersek
2016-10-17  9:06 ` Fu, Siyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476428061-23960-1-git-send-email-lubo.zhang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox