From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 04DDB21A16EFF for ; Mon, 5 Jun 2017 00:14:48 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP; 05 Jun 2017 00:15:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,299,1493708400"; d="scan'208";a="1178338034" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2017 00:15:50 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 5 Jun 2017 00:15:50 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 5 Jun 2017 00:15:50 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.56]) with mapi id 14.03.0319.002; Mon, 5 Jun 2017 15:15:43 +0800 From: "Ye, Ting" To: "Wu, Jiaxin" , Paulo Alcantara , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential memory leaks Thread-Index: AQHS0vHk8WibCJQPHE6N0Q6HZnhYjqIBJYNAgBTLnNA= Date: Mon, 5 Jun 2017 07:15:43 +0000 Message-ID: References: <20170521134217.6667-1-pcacjr@gmail.com> <20170522115211.7133-1-pcacjr@gmail.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential memory leaks X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2017 07:14:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: Wu, Jiaxin=20 Sent: Tuesday, May 23, 2017 10:11 AM To: Paulo Alcantara ; edk2-devel@lists.01.org Cc: Dong, Eric ; Zeng, Star Subject: RE: [edk2] [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential memor= y leaks Reviewed-by: Wu Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Paulo Alcantara > Sent: Monday, May 22, 2017 7:52 PM > To: edk2-devel@lists.01.org > Cc: Dong, Eric ; Zeng, Star > Subject: [edk2] [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential=20 > memory leaks >=20 > Cc: Star Zeng > Cc: Eric Dong > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Paulo Alcantara > --- > MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) >=20 > diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c > b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c > index 8421caa..2929238 100644 > --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c > +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c > @@ -523,6 +523,7 @@ HttpUrlGetHostName ( > &ResultLength > ); > if (EFI_ERROR (Status)) { > + FreePool (Name); > return Status; > } >=20 > @@ -582,6 +583,7 @@ HttpUrlGetIp4 ( > &ResultLength > ); > if (EFI_ERROR (Status)) { > + FreePool (Ip4String); > return Status; > } >=20 > @@ -657,6 +659,7 @@ HttpUrlGetIp6 ( > &ResultLength > ); > if (EFI_ERROR (Status)) { > + FreePool (Ip6String); > return Status; > } >=20 > @@ -722,14 +725,15 @@ HttpUrlGetPort ( > &ResultLength > ); > if (EFI_ERROR (Status)) { > - return Status; > + goto ON_EXIT; > } >=20 > PortString[ResultLength] =3D '\0'; >=20 > while (Index < ResultLength) { > if (!NET_IS_DIGIT (PortString[Index])) { > - return EFI_INVALID_PARAMETER; > + Status =3D EFI_INVALID_PARAMETER; > + goto ON_EXIT; > } > Index ++; > } > @@ -737,10 +741,14 @@ HttpUrlGetPort ( > Status =3D AsciiStrDecimalToUintnS (Url + Parser- > >FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data); >=20 > if (Data > HTTP_URI_PORT_MAX_NUM) { > - return EFI_INVALID_PARAMETER; > + Status =3D EFI_INVALID_PARAMETER; > + goto ON_EXIT; > } >=20 > *Port =3D (UINT16) Data; > + > +ON_EXIT: > + FreePool (PortString); > return Status; > } >=20 > @@ -795,6 +803,7 @@ HttpUrlGetPath ( > &ResultLength > ); > if (EFI_ERROR (Status)) { > + FreePool (PathStr); > return Status; > } >=20 > -- > 2.9.4 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel