NetworkPkg: Remove TokenEntry from Token list before freed

TokenEntry should be removed from Token list before freed.
Otherwise, invalid TokenEntry will be existed in Token list.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Jiaxin Wu 2016-06-02 16:23:16 +08:00
parent 08c6239d03
commit 520a0746dc
1 changed files with 8 additions and 0 deletions

View File

@ -493,6 +493,8 @@ Dns4HostNameToIp (
//
Status = DoDnsQuery (Instance, Packet);
if (EFI_ERROR (Status)) {
Dns4RemoveTokenEntry (&Instance->Dns4TxTokens, TokenEntry);
if (TokenEntry != NULL) {
FreePool (TokenEntry);
}
@ -675,6 +677,8 @@ Dns4GeneralLookUp (
//
Status = DoDnsQuery (Instance, Packet);
if (EFI_ERROR (Status)) {
Dns4RemoveTokenEntry (&Instance->Dns4TxTokens, TokenEntry);
if (TokenEntry != NULL) {
FreePool (TokenEntry);
}
@ -1303,6 +1307,8 @@ Dns6HostNameToIp (
//
Status = DoDnsQuery (Instance, Packet);
if (EFI_ERROR (Status)) {
Dns6RemoveTokenEntry (&Instance->Dns6TxTokens, TokenEntry);
if (TokenEntry != NULL) {
FreePool (TokenEntry);
}
@ -1488,6 +1494,8 @@ Dns6GeneralLookUp (
//
Status = DoDnsQuery (Instance, Packet);
if (EFI_ERROR (Status)) {
Dns6RemoveTokenEntry (&Instance->Dns6TxTokens, TokenEntry);
if (TokenEntry != NULL) {
FreePool (TokenEntry);
}