From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 8FDEC2035D32A for ; Mon, 8 Jan 2018 17:21:56 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 17:27:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,333,1511856000"; d="scan'208";a="8879446" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga007.jf.intel.com with ESMTP; 08 Jan 2018 17:27:06 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 17:27:06 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 17:27:05 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Tue, 9 Jan 2018 09:27:04 +0800 From: "Wu, Jiaxin" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" Thread-Topic: [edk2] [Patch 2/2] MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak. Thread-Index: AQHTiOfjN5wtIucIjUaSMQtfvVr7zKNqwBAA Date: Tue, 9 Jan 2018 01:27:04 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741635B272@SHSMSX103.ccr.corp.intel.com> References: <1515460747-8372-1-git-send-email-fan.wang@intel.com> <1515460747-8372-3-git-send-email-fan.wang@intel.com> In-Reply-To: <1515460747-8372-3-git-send-email-fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWEyYmY2NDItMzdlOC00YWZhLWI4NjAtZWI5NzE1ZWJkYWYyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjB2R3lTaXRodVhVXC9LTDlOQzhmc3BrZHNXNW9WMWJNdjBHQVBHRjF6U2l3PSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Tue, 09 Jan 2018 01:21:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiaxin Wu > -----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 ; Fu, Siyuan ; Wu, > Jiaxin > Subject: [edk2] [Patch 2/2] MdeModulePkg: Freed packet buffer when error > occurs to avoid memory leak. >=20 > * 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. >=20 > Cc: Jiaxin Wu > Cc: Ye Ting > Cc: Fu Siyuan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Wang Fan > --- > MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > 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). >=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 BS= D > License > which accompanies this distribution. The full text of the license may b= e > 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" > ); > -- > 1.9.5.msysgit.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel