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>
This commit is contained in:
Zhang Lubo 2016-10-14 14:51:24 +08:00 committed by Jiaxin Wu
parent 6692d51954
commit 8aa2cdd79f
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}