Reviewed-by: Jiaxin Wu <[email protected]>

> -----Original Message-----
> From: edk2-devel [mailto:[email protected]] On Behalf Of
> Wang Fan
> Sent: Tuesday, January 9, 2018 9:19 AM
> To: [email protected]
> Cc: Ye, Ting <[email protected]>; Fu, Siyuan <[email protected]>; Wu,
> Jiaxin <[email protected]>
> 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 <[email protected]>
> Cc: Ye Ting <[email protected]>
> Cc: Fu Siyuan <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wang Fan <[email protected]>
> ---
>  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
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to