From nobody Mon Feb 9 07:32:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+110298+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+110298+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1698652171; cv=none; d=zohomail.com; s=zohoarc; b=EenFQdvroXe3nL+8HWqcabgv/Bs/mxW45ZvYZhnTCG3VtABIK6e4OEhQOcwatdgSNYnLcaROkBO55EFZpRbK0ZlJ9S4AlfZpnukkoYPFxumf9S7YhevX8IaJBklSvEU2//o4oXk1uGL1KsuK6C088dV18xkqbCQE3LqBrSOj6NU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698652171; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=Oqm9FOU+4/Z6FkdOhAs8kF4qZiFaY8qLAoJtIGiqEKM=; b=j3TLOLwz8S7vFTXZtyoZCfazvnwadshFhxQ/3NLLLra+R6rMgRBfaV89iLbeOhh/2EiPj3fiSp5o4CQoyWiwQX03H+noDyHoueeMZOYbiktdRLMOOxARl2Wt8sWw/EVSoGKyBsO/4PRTkLyLh4RfAsfPei8+TNz/LGeyHw/1DTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+110298+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1698652171927696.583899158619; Mon, 30 Oct 2023 00:49:31 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=aAe0k+zI5YhkjNQeXLKrBO84sM1b9ub5CzlZiF5I0wk=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698652171; v=1; b=Ffqglh8hyz2BDLR34SSQMYyFhvIXa0hOLDJPty3h5bZy7CSgVAMZZFf1/06j5GSRF0JznDuW /ZEPyIKLe4xWl77PBTCI8Z8Jsgm6rQHTm47kxafyv3NWKz/ivgxtqoSM+iluNIPfvpZtSPG+OYl teC4gpoL340qcyawcDW/zkd4= X-Received: by 127.0.0.2 with SMTP id 9tQsYY1788612xmphS8vrGw1; Mon, 30 Oct 2023 00:49:31 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.143793.1698652164261209974 for ; Mon, 30 Oct 2023 00:49:31 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="419138578" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="419138578" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 00:49:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="736666726" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="736666726" X-Received: from shpfwdbuild003.ccr.corp.intel.com ([10.239.56.82]) by orsmga006.jf.intel.com with ESMTP; 30 Oct 2023 00:49:28 -0700 From: "Xu, Wei6" To: devel@edk2.groups.io Cc: Wei6 Xu , Laszlo Ersek , Ard Biesheuvel , Sami Mujawar , Ray Ni Subject: [edk2-devel] [PATCH v3 2/4] StandaloneMmPkg/Core: Fix potential memory leak issue Date: Mon, 30 Oct 2023 15:49:16 +0800 Message-Id: <612df6233746ce55990359472221a193c398749b.1698651605.git.wei6.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,wei6.xu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MdWmDRqCZowcKFRLOuJSnaolx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698652173068100001 Content-Type: text/plain; charset="utf-8" In MmCoreFfsFindMmDriver(), ScratchBuffer is not freed in the error return path that DstBuffer page allocation fails. Free ScratchBuffer before return with error. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Ray Ni Signed-off-by: Wei6 Xu Reviewed-by: Laszlo Ersek --- StandaloneMmPkg/Core/FwVol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c index e1e20ffd14ac..9d0ce66ef839 100644 --- a/StandaloneMmPkg/Core/FwVol.c +++ b/StandaloneMmPkg/Core/FwVol.c @@ -150,6 +150,7 @@ MmCoreFfsFindMmDriver ( // DstBuffer =3D (VOID *)(UINTN)AllocatePages (EFI_SIZE_TO_PAGES (DstBuff= erSize)); if (DstBuffer =3D=3D NULL) { + FreePages (ScratchBuffer, EFI_SIZE_TO_PAGES (ScratchBufferSize)); return EFI_OUT_OF_RESOURCES; } =20 --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110298): https://edk2.groups.io/g/devel/message/110298 Mute This Topic: https://groups.io/mt/102270547/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-