From: Bi, Dandan Date: Tue, 27 Feb 2018 05:53:47 +0000 (+0800) Subject: BaseTool/VfrCompile: Fix potential memory leak issue X-Git-Tag: edk2-stable201903~2050 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=65e0e10d23323b18f31bf9aa9eef3c2434f53780;hp=f7e98581021b2dd29824f1de03c523b9c1ec617a BaseTool/VfrCompile: Fix potential memory leak issue 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 Reviewed-by: Liming Gao --- diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp index 9bdc54462c..5cab7bbfa1 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp @@ -3504,6 +3504,10 @@ CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName) return; } + if (mStringFileName != NULL) { + delete[] mStringFileName; + } + FileLen = strlen (StringFileName) + 1; mStringFileName = new CHAR8[FileLen]; if (mStringFileName == NULL) {