From nobody Fri May 3 23:14:24 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.com; dkim=fail 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 149545394555210.759255120369403; Mon, 22 May 2017 04:52:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DE37B21A134BB; Mon, 22 May 2017 04:52:21 -0700 (PDT) Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AF8CE21A18AAB for ; Mon, 22 May 2017 04:52:20 -0700 (PDT) Received: by mail-qk0-x241.google.com with SMTP id y128so18481668qka.3 for ; Mon, 22 May 2017 04:52:20 -0700 (PDT) Received: from thor.domain.name ([2804:7f4:c480:9cf5::2]) by smtp.gmail.com with ESMTPSA id a15sm11450007qkb.24.2017.05.22.04.52.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 04:52:18 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vBTL1IHBdF/G0osXEVIepJM8TxtEdxtwxVcz2rLMF1U=; b=iVW+x6SipywwREkQuXGqaFOrDzYXAGHC2mGbvMVZTKmdMh+goaKo+lUizXdU8DTLnx q+kjuG2dLq3C5++5yiUcNnD8bUIWASI4rYy1A7gkBVwaooyleRNE0611uB8D9Lb47e0Z 3htVFYy67RiwJ03vlAQbpoiCmfM/Mn9o6z6tbMu6SEqjsEe7wlTEuIVi9SrRBanqa2GJ Y4mujtURcKkmMXQf3IglZtGC5x4p0ziplt+M3etImQ/cN3GTwYeiRdtZoo5zzvKGT15Q 8z57obg/9AkzYpV23ej/vUXSZxPH4aETE/YdosLRumWBhpyBjyY4POgUDlDrcyBvgev1 K1JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vBTL1IHBdF/G0osXEVIepJM8TxtEdxtwxVcz2rLMF1U=; b=QV+dlQSa5aHeaOE0pT4bv6TMfuF+L10xWi2ojn/w5g+TxI1+FOqk5bXYOULQ86B8i0 I+YHz2OwK7qtmTxUsnG81I+dhAfFwXnsD2sJ+zAk8zi+v8rrku2s6H6ehqh5n9l1PSsS 3dRT/sBd3xCjawU0K0vWOv/f/rHr3WgfRvPO71Ib6TyWLlTmiP48fmjw83E2qIPqlYQB gyQ6dl1AMGbecdYq9V7A15E0Z+Vtfj+bAvNI0pAH8lY9KEuS8Z2neIe2MNdmg/BE0Q3R 4XSh40fgjZ+lGop5JN5Hijzvo2MAVUPxf7/smo4W5Et5NChq/wVdD/E7gPM1EHlRWrDt 2a7g== X-Gm-Message-State: AODbwcBKeH7coAukg/tXjy+0DYb00Q6wEymMltcqv6+Lv0JEFoBOIdpj 1HY47PIgxNpO7g== X-Received: by 10.233.221.129 with SMTP id r123mr5853520qkf.0.1495453939734; Mon, 22 May 2017 04:52:19 -0700 (PDT) From: Paulo Alcantara To: edk2-devel@lists.01.org Date: Mon, 22 May 2017 08:52:11 -0300 Message-Id: <20170522115211.7133-1-pcacjr@gmail.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170521134217.6667-1-pcacjr@gmail.com> References: <20170521134217.6667-1-pcacjr@gmail.com> Subject: [edk2] [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: , Cc: Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Paulo Alcantara Reviewed-by: Wu Jiaxin --- MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Li= brary/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_FI= ELD_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 --=20 2.9.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel