From nobody Fri May 3 07:06:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 1514341888564387.4287456606013; Tue, 26 Dec 2017 18:31:28 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 53866222F4E20; Tue, 26 Dec 2017 18:26:31 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 08978222447DF for ; Tue, 26 Dec 2017 18:26:29 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2017 18:31:24 -0800 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.15]) by fmsmga001.fm.intel.com with ESMTP; 26 Dec 2017 18:31:24 -0800 X-Original-To: edk2-devel@lists.01.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; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,462,1508828400"; d="scan'208";a="16775752" From: Liming Gao To: edk2-devel@lists.01.org Date: Wed, 27 Dec 2017 10:31:19 +0800 Message-Id: <1514341879-10544-1-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 Subject: [edk2] [Patch] MdeModulePkg HiiDataBase: Fix the potential NULL pointer reference 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: , Cc: Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Star Zeng --- MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePk= g/Universal/HiiDatabaseDxe/Database.c index c10134b8e6..e062094f79 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -845,7 +845,7 @@ UpdateDefaultSettingInFormPackage ( // EfiVarStoreList =3D ReallocatePool (EfiVarStoreMaxNum * sizeof (= UINTN), (EfiVarStoreMaxNum + BASE_NUMBER) * sizeof (UINTN), EfiVarStoreList= ); if (EfiVarStoreList =3D=3D NULL) { - break; + goto Done; } EfiVarStoreMaxNum =3D EfiVarStoreMaxNum + BASE_NUMBER; } @@ -874,7 +874,7 @@ UpdateDefaultSettingInFormPackage ( // DefaultIdList =3D ReallocatePool (DefaultIdMaxNum * sizeof (UINT= 16), (DefaultIdMaxNum + BASE_NUMBER) * sizeof (UINT16), DefaultIdList); if (DefaultIdList =3D=3D NULL) { - break; + goto Done; } DefaultIdMaxNum =3D DefaultIdMaxNum + BASE_NUMBER; } @@ -1046,8 +1046,10 @@ UpdateDefaultSettingInFormPackage ( } =20 Done: - for (Index =3D 0; Index < EfiVarStoreNumber; Index ++) { - FreePool (EfiVarStoreList [Index]); + if (EfiVarStoreList !=3D NULL) {=20 + for (Index =3D 0; Index < EfiVarStoreNumber; Index ++) { + FreePool (EfiVarStoreList [Index]); + } } return; } --=20 2.11.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel