BaseTool/VfrCompile: Fix potential memory leak issue
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrUtilityLib.cpp
index 9bdc544..5cab7bb 100644 (file)
@@ -3504,6 +3504,10 @@ CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName)
     return;\r
   }\r
 \r
+  if (mStringFileName != NULL) {\r
+    delete[] mStringFileName;\r
+  }\r
+\r
   FileLen = strlen (StringFileName) + 1;\r
   mStringFileName = new CHAR8[FileLen];\r
   if (mStringFileName == NULL) {\r