From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5C8E61A1EC4 for ; Thu, 13 Oct 2016 23:54:28 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 13 Oct 2016 23:54:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,491,1473145200"; d="scan'208";a="772494465" Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.20]) by FMSMGA003.fm.intel.com with ESMTP; 13 Oct 2016 23:54:26 -0700 From: Zhang Lubo To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Fri, 14 Oct 2016 14:54:21 +0800 Message-Id: <1476428061-23960-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] NetworkPkg: Enhance the code in DNS driver. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 06:54:28 -0000 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 Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin --- 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