]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak.
authorWang Fan <fan.wang@intel.com>
Mon, 8 Jan 2018 05:18:26 +0000 (13:18 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 10 Jan 2018 00:30:24 +0000 (08:30 +0800)
* 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>
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c

index e8257147006bff793a58e9f3d772e26c07bb5f6f..438659a76e762965bfc271be6f2b0fb3dbfc6d39 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Routines to process Wrq (upload).\r
   \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -94,6 +94,10 @@ Mtftp4WrqSendBlock (
         FreePool (DataBuf);\r
       }\r
 \r
+      if (UdpPacket != NULL) {\r
+        NetbufFree (UdpPacket);\r
+      }\r
+\r
       Mtftp4SendError (\r
         Instance,\r
         EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,\r