From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 9D922221C1926 for ; Mon, 18 Dec 2017 19:24:50 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Dec 2017 19:29:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,424,1508828400"; d="scan'208";a="188196748" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.10]) by fmsmga006.fm.intel.com with ESMTP; 18 Dec 2017 19:29:35 -0800 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Liming Gao , Yonghong Zhu Date: Tue, 19 Dec 2017 11:29:09 +0800 Message-Id: <20171219032912.14404-15-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20171219032912.14404-1-hao.a.wu@intel.com> References: <20171219032912.14404-1-hao.a.wu@intel.com> Subject: [PATCH 14/17] BaseTools/VfrCompile: Resolve uninit class variables in constructor X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2017 03:24:50 -0000 The commit initializes those possibly uninitialized class variables in class constructors. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- BaseTools/Source/C/VfrCompile/VfrError.cpp | 1 + BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 6 ++++++ BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp index 0f8f7dd891..2366fac5a7 100644 --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp @@ -67,6 +67,7 @@ CVfrErrorHandle::CVfrErrorHandle ( mScopeRecordListTail = NULL; mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE; mVfrWarningHandleTable = VFR_WARNING_HANDLE_TABLE; + mWarningAsError = FALSE; } CVfrErrorHandle::~CVfrErrorHandle ( diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp index b8350623f2..0f0efd4c6d 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp @@ -104,8 +104,13 @@ CFormPkg::CFormPkg ( SBufferNode *Node; mPkgLength = 0; + mBufferSize = 0; mBufferNodeQueueHead = NULL; + mBufferNodeQueueTail = NULL; mCurrBufferNode = NULL; + mReadBufferNode = NULL; + mReadBufferOffset = 0; + PendingAssignList = NULL; Node = new SBufferNode; if (Node == NULL) { @@ -2421,6 +2426,7 @@ CIfrObj::CIfrObj ( mObjBinLen = (ObjBinLen == 0) ? gOpcodeSizesScopeTable[OpCode].mSize : ObjBinLen; mObjBinBuf = ((DelayEmit == FALSE) && (gCreateOp == TRUE)) ? gCFormPkg.IfrBinBufferGet (mObjBinLen) : new CHAR8[EFI_IFR_MAX_LENGTH]; mRecordIdx = (gCreateOp == TRUE) ? gCIfrRecordInfoDB.IfrRecordRegister (0xFFFFFFFF, mObjBinBuf, mObjBinLen, mPkgOffset) : EFI_IFR_RECORDINFO_IDX_INVALUD; + mLineNo = 0; assert (mObjBinBuf != NULL); diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp index 4866639aab..c536498d77 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp @@ -958,6 +958,7 @@ CVfrVarDataTypeDB::CVfrVarDataTypeDB ( mPackAlign = DEFAULT_PACK_ALIGN; mPackStack = NULL; mFirstNewDataTypeName = NULL; + mCurrDataType = NULL; InternalTypesListInit (); } @@ -1605,6 +1606,7 @@ SVfrVarStorageNode::SVfrVarStorageNode ( IN EFI_VARSTORE_ID VarStoreId ) { + memset (&mGuid, 0, sizeof (EFI_GUID)); if (StoreName != NULL) { mVarStoreName = new CHAR8[strlen(StoreName) + 1]; strcpy (mVarStoreName, StoreName); @@ -1616,6 +1618,7 @@ SVfrVarStorageNode::SVfrVarStorageNode ( mVarStoreType = EFI_VFR_VARSTORE_NAME; mStorageInfo.mNameSpace.mNameTable = new EFI_VARSTORE_ID[DEFAULT_NAME_TABLE_ITEMS]; mStorageInfo.mNameSpace.mTableSize = 0; + mAssignedFlag = FALSE; } SVfrVarStorageNode::~SVfrVarStorageNode ( -- 2.12.0.windows.1