From nobody Sat May 4 03:29:48 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; 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 1490626930037429.7810452102773; Mon, 27 Mar 2017 08:02:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 67DE721DFA7BB; Mon, 27 Mar 2017 08:02:08 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 8767A21DFA917 for ; Mon, 27 Mar 2017 08:02:06 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 08:02:05 -0700 Received: from jyao1-mobl.ccr.corp.intel.com ([10.254.212.12]) by orsmga002.jf.intel.com with ESMTP; 27 Mar 2017 08:02:03 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490626926; x=1522162926; h=from:to:cc:subject:date:message-id; bh=pS5dcrF3wxGfdPI/19P9waqA2eOqBazZeJLsn5g2UqQ=; b=aoiwpT9ZluiKUMLhGV7iwGpmYHtklIrh4NS09/k3/tN2G4oU4f1e2xUZ YbMrumc/+Alw7oxJYlsfnMllj3ZZ1g==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,231,1486454400"; d="scan'208";a="65543286" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Mon, 27 Mar 2017 23:02:00 +0800 Message-Id: <1490626920-16316-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [edk2] [PATCH] MdeModulePkg/SmmCore: Fix memory leak on Profile unregistered. 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: Feng Tian , Jeff Fan , 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" Issue reported at bugzillar 445. Cc: Jeff Fan Cc: Feng Tian Cc: Star Zeng Cc: Bret Barkelew Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Reviewed-by: Jeff Fan --- MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c b/MdeModulePkg= /Core/PiSmmCore/SmiHandlerProfile.c index 1e36039..ad3b54a 100644 --- a/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c +++ b/MdeModulePkg/Core/PiSmmCore/SmiHandlerProfile.c @@ -1186,7 +1186,9 @@ SmiHandlerProfileRegisterHandler ( =20 SmiEntry =3D SmmCoreFindHardwareSmiEntry (HandlerGuid, TRUE); if (SmiEntry =3D=3D NULL) { - FreePool (SmiHandler->Context); + if (SmiHandler->Context !=3D NULL) { + FreePool (SmiHandler->Context); + } FreePool (SmiHandler); return EFI_OUT_OF_RESOURCES; } @@ -1277,6 +1279,9 @@ SmiHandlerProfileUnregisterHandler ( SmiHandler =3D TargetSmiHandler; =20 RemoveEntryList (&SmiHandler->Link); + if (SmiHandler->Context !=3D NULL) { + FreePool (SmiHandler->Context); + } FreePool (SmiHandler); =20 if (IsListEmpty (&SmiEntry->SmiHandlers)) { --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel