From nobody Mon Dec 23 17:37:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1515460758692131.8659354749807; Mon, 8 Jan 2018 17:19:18 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2A96F21CB87BC; Mon, 8 Jan 2018 17:14:07 -0800 (PST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B18D32035D32C for ; Mon, 8 Jan 2018 17:14:05 -0800 (PST) Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 17:19:15 -0800 Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by fmsmga007.fm.intel.com with ESMTP; 08 Jan 2018 17:19:14 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,333,1511856000"; d="scan'208";a="8181735" From: Wang Fan To: edk2-devel@lists.01.org Date: Tue, 9 Jan 2018 09:19:07 +0800 Message-Id: <1515460747-8372-3-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1515460747-8372-1-git-send-email-fan.wang@intel.com> References: <1515460747-8372-1-git-send-email-fan.wang@intel.com> Subject: [edk2] [Patch 2/2] MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Fu Siyuan , Jiaxin Wu MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" * 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 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan Reviewed-by: Fu Siyuan Reviewed-by: Jiaxin Wu --- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c b/MdeModu= lePkg/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). =20 -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
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
=20 @@ -92,10 +92,14 @@ Mtftp4WrqSendBlock ( if (EFI_ERROR (Status) || (DataLen > Instance->BlkSize)) { if (DataBuf !=3D NULL) { FreePool (DataBuf); } =20 + if (UdpPacket !=3D NULL) { + NetbufFree (UdpPacket); + } + Mtftp4SendError ( Instance, EFI_MTFTP4_ERRORCODE_REQUEST_DENIED, (UINT8 *) "User aborted the transfer" ); --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel