From: "Fu, Siyuan" <siyuan.fu@intel.com>
To: "Wang, Fan" <fan.wang@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ye, Ting" <ting.ye@intel.com>, "Wu, Jiaxin" <jiaxin.wu@intel.com>
Subject: Re: [Patch 2/2] MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak.
Date: Tue, 9 Jan 2018 02:32:06 +0000 [thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58B40E2FC@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1515460747-8372-3-git-send-email-fan.wang@intel.com>
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
prev parent reply other threads:[~2018-01-09 2:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 1:19 [Patch 0/2] Fixed some issues in Mtftp4Dxe Wang Fan
2018-01-09 1:19 ` [Patch 1/2] MdeModulePkg: Fixed two issues when error occurs in Mtftp4Start Wang Fan
2018-01-09 1:26 ` Wu, Jiaxin
2018-01-09 6:58 ` Fu, Siyuan
2018-01-09 1:19 ` [Patch 2/2] MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak Wang Fan
2018-01-09 1:27 ` Wu, Jiaxin
2018-01-09 2:32 ` Fu, Siyuan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B1FF2E9001CE9041BD10B825821D5BC58B40E2FC@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox