BaseTools/VfrCompile: Initialize local variables before being used

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Hao Wu
2016-10-11 10:56:20 +08:00
parent 10bcabc6be
commit 61eb9834a3
2 changed files with 5 additions and 3 deletions

View File

@ -825,7 +825,7 @@ CFormPkg::DeclarePendingQuestion (
CHAR8 FName[MAX_NAME_LEN]; CHAR8 FName[MAX_NAME_LEN];
CHAR8 *SName; CHAR8 *SName;
CHAR8 *NewStr; CHAR8 *NewStr;
UINT32 ShrinkSize; UINT32 ShrinkSize = 0;
EFI_VFR_RETURN_CODE ReturnCode; EFI_VFR_RETURN_CODE ReturnCode;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID; EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID; EFI_VARSTORE_ID VarStoreId = EFI_VARSTORE_ID_INVALID;
@ -1297,6 +1297,7 @@ CIfrRecordInfoDB::IfrAdjustDynamicOpcodeInRecords (
SIfrRecord *pAdjustNode, *pNodeBeforeAdjust; SIfrRecord *pAdjustNode, *pNodeBeforeAdjust;
SIfrRecord *pNodeBeforeDynamic; SIfrRecord *pNodeBeforeDynamic;
pPreNode = NULL;
pAdjustNode = NULL; pAdjustNode = NULL;
pNodeBeforeDynamic = NULL; pNodeBeforeDynamic = NULL;
OpcodeOffset = 0; OpcodeOffset = 0;
@ -1845,6 +1846,7 @@ CIfrRecordInfoDB::IfrCreateDefaultForQuestion (
// Point to the first expression opcode. // Point to the first expression opcode.
// //
pSNode = pDefaultNode->mNext; pSNode = pDefaultNode->mNext;
pENode = NULL;
ScopeCount++; ScopeCount++;
// //
// Get opcode number behind the EFI_IFR_DEFAULT_2 until reach its END opcode (including the END opcode of EFI_IFR_DEFAULT_2) // Get opcode number behind the EFI_IFR_DEFAULT_2 until reach its END opcode (including the END opcode of EFI_IFR_DEFAULT_2)

View File

@ -1328,7 +1328,7 @@ SVfrVarStorageNode::SVfrVarStorageNode (
if (Guid != NULL) { if (Guid != NULL) {
mGuid = *Guid; mGuid = *Guid;
} else { } else {
memset (&Guid, 0, sizeof (EFI_GUID)); memset (&mGuid, 0, sizeof (EFI_GUID));
} }
if (StoreName != NULL) { if (StoreName != NULL) {
mVarStoreName = new CHAR8[strlen(StoreName) + 1]; mVarStoreName = new CHAR8[strlen(StoreName) + 1];
@ -1355,7 +1355,7 @@ SVfrVarStorageNode::SVfrVarStorageNode (
if (Guid != NULL) { if (Guid != NULL) {
mGuid = *Guid; mGuid = *Guid;
} else { } else {
memset (&Guid, 0, sizeof (EFI_GUID)); memset (&mGuid, 0, sizeof (EFI_GUID));
} }
if (StoreName != NULL) { if (StoreName != NULL) {
mVarStoreName = new CHAR8[strlen(StoreName) + 1]; mVarStoreName = new CHAR8[strlen(StoreName) + 1];