From: Liming Gao Date: Thu, 25 Nov 2021 16:11:06 +0000 (+0800) Subject: NetworkPkg: Fix invalid pointer for DNS response token on error X-Git-Tag: edk2-stable202202~300 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=bb1bba3d776733c41dbfa2d1dc0fe234819a79f2 NetworkPkg: Fix invalid pointer for DNS response token on error Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3719 This issue is introduced by the commit 43d7e607. Token->RspData.H2AData is de-allocated on error but it is not set to NULL. HTTP module attempts to free again and cause assert. Signed-off-by: Baraneedharan Anbazhagan Reviewed-by: Wu Jiaxin --- diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c index 2edcb280ac..78a56f2b56 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1700,6 +1700,7 @@ ON_EXIT: } FreePool (Dns4TokenEntry->Token->RspData.H2AData); + Dns4TokenEntry->Token->RspData.H2AData = NULL; } } } @@ -1731,6 +1732,7 @@ ON_EXIT: } FreePool (Dns6TokenEntry->Token->RspData.H2AData); + Dns6TokenEntry->Token->RspData.H2AData = NULL; } } }