* 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>
---
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
index e825714..438659a 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
@@ -1,9 +1,9 @@
/** @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
http://opensource.org/licenses/bsd-license.php<BR>
@@ -92,10 +92,14 @@ Mtftp4WrqSendBlock (
if (EFI_ERROR (Status) || (DataLen > Instance->BlkSize)) {
if (DataBuf != NULL) {
FreePool (DataBuf);
}
+ if (UdpPacket != NULL) {
+ NetbufFree (UdpPacket);
+ }
+
Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
(UINT8 *) "User aborted the transfer"
);
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Wang Fan > Sent: Tuesday, January 9, 2018 9:19 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, > Jiaxin <jiaxin.wu@intel.com> > Subject: [edk2] [Patch 2/2] 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> > --- > MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > index e825714..438659a 100644 > --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > @@ -1,9 +1,9 @@ > /** @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 > http://opensource.org/licenses/bsd-license.php<BR> > > @@ -92,10 +92,14 @@ Mtftp4WrqSendBlock ( > if (EFI_ERROR (Status) || (DataLen > Instance->BlkSize)) { > if (DataBuf != NULL) { > FreePool (DataBuf); > } > > + if (UdpPacket != NULL) { > + NetbufFree (UdpPacket); > + } > + > Mtftp4SendError ( > Instance, > EFI_MTFTP4_ERRORCODE_REQUEST_DENIED, > (UINT8 *) "User aborted the transfer" > ); > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Wang Fan > Sent: Tuesday, January 9, 2018 9:19 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, > Jiaxin <jiaxin.wu@intel.com> > Subject: [edk2] [Patch 2/2] 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> > --- > MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > index e825714..438659a 100644 > --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c > @@ -1,9 +1,9 @@ > /** @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 > http://opensource.org/licenses/bsd-license.php<BR> > > @@ -92,10 +92,14 @@ Mtftp4WrqSendBlock ( > if (EFI_ERROR (Status) || (DataLen > Instance->BlkSize)) { > if (DataBuf != NULL) { > FreePool (DataBuf); > } > > + if (UdpPacket != NULL) { > + NetbufFree (UdpPacket); > + } > + > Mtftp4SendError ( > Instance, > EFI_MTFTP4_ERRORCODE_REQUEST_DENIED, > (UINT8 *) "User aborted the transfer" > ); > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.