summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorWang Fan <fan.wang@intel.com>2018-01-08 13:18:26 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2018-01-10 08:30:24 +0800
commit36c19ee6c7c4455f5de2817052444d1a0dad0e3d (patch)
treeacbb4269fe22bc6a1970e2c57b5f9c040e75d083 /MdeModulePkg
parent39b0867d836292be0ffaffd2cc1edb7049c9fddd (diff)
downloadedk2-36c19ee6c7c4455f5de2817052444d1a0dad0e3d.tar.gz
edk2-36c19ee6c7c4455f5de2817052444d1a0dad0e3d.tar.bz2
edk2-36c19ee6c7c4455f5de2817052444d1a0dad0e3d.zip
MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak.
* In function Mtftp4WrqSendBlock(), when packet is not needed, function returns EFI_ABORTED but not freed the packet buffer. It results some memory leak and this patch is to fix this issue. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
index e825714700..438659a76e 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
@@ -1,7 +1,7 @@
/** @file
Routines to process Wrq (upload).
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -94,6 +94,10 @@ Mtftp4WrqSendBlock (
FreePool (DataBuf);
}
+ if (UdpPacket != NULL) {
+ NetbufFree (UdpPacket);
+ }
+
Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,