From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 3752E20955F07 for ; Mon, 26 Feb 2018 21:48:09 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 21:54:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,398,1515484800"; d="scan'208";a="178351808" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga004.jf.intel.com with ESMTP; 26 Feb 2018 21:54:13 -0800 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Eric Dong , Liming Gao Date: Tue, 27 Feb 2018 13:53:47 +0800 Message-Id: <1519710827-11228-2-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1519710827-11228-1-git-send-email-dandan.bi@intel.com> References: <1519710827-11228-1-git-send-email-dandan.bi@intel.com> Subject: [patch 2/2] BaseTool/VfrCompile: Fix potential memory leak issue 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: , X-List-Received-Date: Tue, 27 Feb 2018 05:48:09 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=771 Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp index 9bdc544..5cab7bb 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp @@ -3502,10 +3502,14 @@ CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName) if (StringFileName == NULL) { return; } + if (mStringFileName != NULL) { + delete[] mStringFileName; + } + FileLen = strlen (StringFileName) + 1; mStringFileName = new CHAR8[FileLen]; if (mStringFileName == NULL) { return; } -- 1.9.5.msysgit.1