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>
This commit is contained in:
Wang Fan 2018-01-08 13:18:26 +08:00 committed by Jiaxin Wu
parent 39b0867d83
commit 36c19ee6c7
1 changed files with 5 additions and 1 deletions

View File

@ -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,