]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
BaseTool/VfrCompile: Support Union type in VFR
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrFormPkg.cpp
index aa27ce0be72e0682bbda0e9183eaa7bfb3969079..2be0c385e31371a28ce542ec78f166907301fff5 100644 (file)
@@ -56,13 +56,13 @@ SPendingAssign::~SPendingAssign (
   )\r
 {\r
   if (mKey != NULL) {\r
-    delete mKey;\r
+    delete[] mKey;\r
   }\r
   mAddr   = NULL;\r
   mLen    = 0;\r
   mLineNo = 0;\r
   if (mMsg != NULL) {\r
-    delete mMsg;\r
+    delete[] mMsg;\r
   }\r
   mNext   = NULL;\r
 }\r
@@ -113,6 +113,7 @@ CFormPkg::CFormPkg (
   }\r
   BufferStart = new CHAR8[BufferSize];\r
   if (BufferStart == NULL) {\r
+    delete Node;\r
     return;\r
   }\r
   BufferEnd   = BufferStart + BufferSize;\r
@@ -825,10 +826,9 @@ CFormPkg::DeclarePendingQuestion (
   CHAR8          FName[MAX_NAME_LEN];\r
   CHAR8          *SName;\r
   CHAR8          *NewStr;\r
-  UINT32         ShrinkSize;\r
+  UINT32         ShrinkSize = 0;\r
   EFI_VFR_RETURN_CODE  ReturnCode;\r
   EFI_VFR_VARSTORE_TYPE VarStoreType  = EFI_VFR_VARSTORE_INVALID;\r
-  EFI_VARSTORE_ID       VarStoreId    = EFI_VARSTORE_ID_INVALID;\r
 \r
   //\r
   // Declare all questions as Numeric in DisableIf True\r
@@ -898,7 +898,7 @@ CFormPkg::DeclarePendingQuestion (
             strcpy (NewStr, SName);\r
             strcat (NewStr, VarStr + strlen (FName));\r
             ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (NewStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);\r
-            delete NewStr;\r
+            delete[] NewStr;\r
           }\r
         } else {\r
           ReturnCode = VFR_RETURN_UNSUPPORTED;\r
@@ -1297,6 +1297,7 @@ CIfrRecordInfoDB::IfrAdjustDynamicOpcodeInRecords (
   SIfrRecord         *pAdjustNode, *pNodeBeforeAdjust;\r
   SIfrRecord         *pNodeBeforeDynamic;\r
 \r
+  pPreNode            = NULL;\r
   pAdjustNode         = NULL;\r
   pNodeBeforeDynamic  = NULL;\r
   OpcodeOffset        = 0;\r
@@ -1364,7 +1365,7 @@ CIfrRecordInfoDB::IfrUpdateRecordInfoForDynamicOpcode (
   // Base on the original offset info to update the record list.\r
   //\r
   if (!IfrAdjustDynamicOpcodeInRecords(CreateOpcodeAfterParsingVfr)) {\r
-    gCVfrErrorHandle.PrintMsg (0, "Error", "Can not find the adjust offset in the record.");\r
+    gCVfrErrorHandle.PrintMsg (0, (CHAR8 *)"Error", (CHAR8 *)"Can not find the adjust offset in the record.");\r
   }\r
 \r
   //\r
@@ -1409,7 +1410,6 @@ CIfrRecordInfoDB::IfrRecordAdjust (
   EFI_QUESTION_ID    QuestionId;\r
   UINT32             StackCount;\r
   UINT32             QuestionScope;\r
-  UINT32             OpcodeOffset;\r
   CHAR8              ErrorMsg[MAX_STRING_LEN] = {0, };\r
   EFI_VFR_RETURN_CODE  Status;\r
 \r
@@ -1845,6 +1845,7 @@ CIfrRecordInfoDB::IfrCreateDefaultForQuestion (
     // Point to the first expression opcode.\r
     //\r
     pSNode = pDefaultNode->mNext;\r
+    pENode = NULL;\r
     ScopeCount++;\r
     //\r
     // Get opcode number behind the EFI_IFR_DEFAULT_2 until reach its END opcode (including the END opcode of EFI_IFR_DEFAULT_2)\r