From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 18BF021A18AA9 for ; Mon, 27 Mar 2017 19:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490667516; x=1522203516; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=LKkQpp63lfQ+CVLOvU/xvp0/GB0Nt06RJmYR5abs6yU=; b=WLkr5l82qx6WQBIcUTV1zFR5RerWV9lEu/5FlV7PMtiDDCORGH5L54wz dU0xinbgwR8BJwpx+uu1IefRULeilw==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 19:18:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,234,1486454400"; d="scan'208";a="1147706850" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 27 Mar 2017 19:18:35 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Mar 2017 19:18:35 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Mar 2017 19:18:35 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.212]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.42]) with mapi id 14.03.0248.002; Tue, 28 Mar 2017 10:18:33 +0800 From: "Fan, Jeff" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Zeng, Star" , Bret Barkelew Thread-Topic: [PATCH] MdeModulePkg/SmmCore: Fix memory leak on Profile unregistered. Thread-Index: AQHSpwtKPm7uPIkOFk6zP8woIUuJLKGphOzQ Date: Tue, 28 Mar 2017 02:18:32 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4C57D098@shsmsx102.ccr.corp.intel.com> References: <1490626920-16316-1-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1490626920-16316-1-git-send-email-jiewen.yao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2FkYjc0NjAtOTExMy00MWY3LTk2NmEtYjViN2NjMzQwOTc4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkRtSENJZXIwM1c1N25TUkNwYXdSbVpoS3dGWDZRXC9sMXRyYzhEWUVGekhvPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Tue, 28 Mar 2017 02:18:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jeff Fan -----Original Message----- From: Yao, Jiewen=20 Sent: Monday, March 27, 2017 11:02 PM To: edk2-devel@lists.01.org Cc: Fan, Jeff; Tian, Feng; Zeng, Star; Bret Barkelew Subject: [PATCH] MdeModulePkg/SmmCore: Fix memory leak on Profile unregiste= red. 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 --- 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