From 8aa2cdd79f9c75429ae1c23ac0f379d901a251d6 Mon Sep 17 00:00:00 2001 From: Zhang Lubo Date: Fri, 14 Oct 2016 14:51:24 +0800 Subject: 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 Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin Reviewed-by: Fu Siyuan Reviewed-by: Wu Jiaxin --- NetworkPkg/DnsDxe/DnsProtocol.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'NetworkPkg/DnsDxe/DnsProtocol.c') diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c index 64fca6a55b..6d117b2892 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -287,6 +287,7 @@ Dns4Configure ( if (EFI_ERROR (Status)) { if (Instance->Dns4CfgData.DnsServerList != NULL) { FreePool (Instance->Dns4CfgData.DnsServerList); + Instance->Dns4CfgData.DnsServerList = NULL; } goto ON_EXIT; } @@ -298,6 +299,7 @@ Dns4Configure ( if (EFI_ERROR (Status)) { if (Instance->Dns4CfgData.DnsServerList != NULL) { FreePool (Instance->Dns4CfgData.DnsServerList); + Instance->Dns4CfgData.DnsServerList = NULL; } goto ON_EXIT; } @@ -1108,6 +1110,7 @@ Dns6Configure ( if (EFI_ERROR (Status)) { if (Instance->Dns6CfgData.DnsServerList != NULL) { FreePool (Instance->Dns6CfgData.DnsServerList); + Instance->Dns6CfgData.DnsServerList = NULL; } goto ON_EXIT; } @@ -1119,6 +1122,7 @@ Dns6Configure ( if (EFI_ERROR (Status)) { if (Instance->Dns6CfgData.DnsServerList != NULL) { FreePool (Instance->Dns6CfgData.DnsServerList); + Instance->Dns6CfgData.DnsServerList = NULL; } goto ON_EXIT; } -- cgit v1.2.3