From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 6095B2035D300 for ; Mon, 8 Jan 2018 18:27:00 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 18:32:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,333,1511856000"; d="scan'208";a="25586450" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 08 Jan 2018 18:32:10 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 18:32:09 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Tue, 9 Jan 2018 10:32:07 +0800 From: "Fu, Siyuan" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Jiaxin" Thread-Topic: [edk2] [Patch 2/2] MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak. Thread-Index: AQHTiOfkpEIndu7q+k+6dwlRs4rUvqNq0j7g Date: Tue, 9 Jan 2018 02:32:06 +0000 Message-ID: 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-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGNlYjRkOTMtNWRmNC00N2JiLWJhNjItNmQxOWEyYTllYzIwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJrOHo4TlwvYWpFQytQOEtDRUp4cHl4NHF1M2VrREw2aVJyNlwvSExQNjh4WnhpQ21VMkZPYnpaQ0tMaVwvQ0NrVzBWIn0= 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 02:27:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan > -----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