From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 0A7AA21B06E84 for ; Fri, 14 Jul 2017 01:52:16 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 14 Jul 2017 01:54:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,358,1496127600"; d="scan'208";a="878838000" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.5]) by FMSMGA003.fm.intel.com with ESMTP; 14 Jul 2017 01:54:05 -0700 From: Star Zeng To: edk2-devel@lists.01.org Cc: Star Zeng , Jiewen Yao Date: Fri, 14 Jul 2017 16:54:01 +0800 Message-Id: <1500022441-260844-3-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1500022441-260844-1-git-send-email-star.zeng@intel.com> References: <1500022441-260844-1-git-send-email-star.zeng@intel.com> Subject: [PATCH 2/2] MdePkg DxeHstiLib: Fix memory leak issue 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: Fri, 14 Jul 2017 08:52:17 -0000 The Hsti returned from InternalHstiFindAip() and temporally allocated NewHsti need to be freed after used. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- MdePkg/Library/DxeHstiLib/HstiDxe.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.c b/MdePkg/Library/DxeHstiLib/HstiDxe.c index c032a98647bf..58510766bb43 100644 --- a/MdePkg/Library/DxeHstiLib/HstiDxe.c +++ b/MdePkg/Library/DxeHstiLib/HstiDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -206,7 +206,7 @@ InternalHstiIsValidTable ( } } if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) { - DEBUG ((EFI_D_ERROR, "ImplementationID is no NUL CHAR\n")); + DEBUG ((EFI_D_ERROR, "ImplementationID has no NUL CHAR\n")); return FALSE; } @@ -416,6 +416,7 @@ InternalHstiRecordFeaturesVerified ( Hsti, HstiSize ); + FreePool (Hsti); return Status; } @@ -545,6 +546,8 @@ InternalHstiRecordErrorString ( NewHsti, NewHstiSize ); + FreePool (Hsti); + FreePool (NewHsti); return Status; } -- 2.7.0.windows.1