From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 31159223E0BA9 for ; Thu, 22 Mar 2018 23:50:06 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2018 23:56:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,348,1517904000"; d="scan'208";a="36146815" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 22 Mar 2018 23:56:38 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 22 Mar 2018 23:56:37 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.226]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.129]) with mapi id 14.03.0319.002; Fri, 23 Mar 2018 14:56:35 +0800 From: "Gao, Liming" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Dong, Eric" Thread-Topic: [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[] Thread-Index: AQHTr49miB97P+OI3Eq2uEP9bk++P6PdiQfw Date: Fri, 23 Mar 2018 06:56:35 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1EC02A@SHSMSX104.ccr.corp.intel.com> References: <1519710827-11228-1-git-send-email-dandan.bi@intel.com> In-Reply-To: <1519710827-11228-1-git-send-email-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[] X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 06:50:06 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Bi, Dandan > Sent: Tuesday, February 27, 2018 1:54 PM > To: edk2-devel@lists.01.org > Cc: Dong, Eric ; Gao, Liming > Subject: [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[] >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D764 >=20 > Cc: Eric Dong > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Dandan Bi > --- > BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 14 +++++++------- > BaseTools/Source/C/VfrCompile/VfrError.cpp | 2 +- > BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 6 +++--- > BaseTools/Source/C/VfrCompile/VfrSyntax.g | 14 +++++++------- > BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 8 ++++---- > 5 files changed, 22 insertions(+), 22 deletions(-) >=20 > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/So= urce/C/VfrCompile/VfrCompiler.cpp > index ff2a837..84c0e59 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp > @@ -1,10 +1,10 @@ > /** @file >=20 > VfrCompiler main class and main function. >=20 > -Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D License > which accompanies this distribution. The full text of the license may b= e found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -282,11 +282,11 @@ CVfrCompiler::AppendIncludePath ( > strcat (IncludePaths, mOptions.IncludePaths); > } > strcat (IncludePaths, " -I "); > strcat (IncludePaths, PathStr); > if (mOptions.IncludePaths !=3D NULL) { > - delete mOptions.IncludePaths; > + delete[] mOptions.IncludePaths; > } > mOptions.IncludePaths =3D IncludePaths; > } >=20 > VOID > @@ -311,11 +311,11 @@ CVfrCompiler::AppendCPreprocessorOptions ( > strcat (Opt, mOptions.CPreprocessorOptions); > } > strcat (Opt, " "); > strcat (Opt, Options); > if (mOptions.CPreprocessorOptions !=3D NULL) { > - delete mOptions.CPreprocessorOptions; > + delete[] mOptions.CPreprocessorOptions; > } > mOptions.CPreprocessorOptions =3D Opt; > } >=20 > INT8 > @@ -529,16 +529,16 @@ CVfrCompiler::~CVfrCompiler ( > free (mOptions.RecordListFile); > mOptions.RecordListFile =3D NULL; > } >=20 > if (mOptions.IncludePaths !=3D NULL) { > - delete mOptions.IncludePaths; > + delete[] mOptions.IncludePaths; > mOptions.IncludePaths =3D NULL; > } >=20 > if (mOptions.CPreprocessorOptions !=3D NULL) { > - delete mOptions.CPreprocessorOptions; > + delete[] mOptions.CPreprocessorOptions; > mOptions.CPreprocessorOptions =3D NULL; > } >=20 > SET_RUN_STATUS(STATUS_DEAD); > } > @@ -963,15 +963,15 @@ main ( > if ((Status =3D=3D STATUS_DEAD) || (Status =3D=3D STATUS_FAILED)) { > return 2; > } >=20 > if (gCBuffer.Buffer !=3D NULL) { > - delete gCBuffer.Buffer; > + delete[] gCBuffer.Buffer; > } >=20 > if (gRBuffer.Buffer !=3D NULL) { > - delete gRBuffer.Buffer; > + delete[] gRBuffer.Buffer; > } >=20 > return GetUtilityStatus (); > } >=20 > diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Sourc= e/C/VfrCompile/VfrError.cpp > index 2366fac..14771a2 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp > @@ -75,11 +75,11 @@ CVfrErrorHandle::~CVfrErrorHandle ( > ) > { > SVfrFileScopeRecord *pNode =3D NULL; >=20 > if (mInputFileName !=3D NULL) { > - delete mInputFileName; > + delete[] mInputFileName; > } >=20 > while (mScopeRecordListHead !=3D NULL) { > pNode =3D mScopeRecordListHead; > mScopeRecordListHead =3D mScopeRecordListHead->mNext; > diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Sou= rce/C/VfrCompile/VfrFormPkg.cpp > index 090ee13..b40bcdf 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp > @@ -142,11 +142,11 @@ CFormPkg::~CFormPkg () >=20 > while (mBufferNodeQueueHead !=3D NULL) { > pBNode =3D mBufferNodeQueueHead; > mBufferNodeQueueHead =3D mBufferNodeQueueHead->mNext; > if (pBNode->mBufferStart !=3D NULL) { > - delete pBNode->mBufferStart; > + delete[] pBNode->mBufferStart; > delete pBNode; > } > } > mBufferNodeQueueTail =3D NULL; > mCurrBufferNode =3D NULL; > @@ -1150,11 +1150,11 @@ CIfrRecordInfoDB::IfrRecordOutput ( > { > CHAR8 *Temp; > SIfrRecord *pNode; >=20 > if (TBuffer.Buffer !=3D NULL) { > - delete TBuffer.Buffer; > + delete[] TBuffer.Buffer; > } >=20 > TBuffer.Size =3D 0; > TBuffer.Buffer =3D NULL; >=20 > @@ -2257,11 +2257,11 @@ CIfrObj::_EMIT_PENDING_OBJ ( >=20 > // > // update bin buffer to package data buffer > // > if (mObjBinBuf !=3D NULL) { > - delete mObjBinBuf; > + delete[] mObjBinBuf; > mObjBinBuf =3D ObjBinBuf; > } >=20 > mDelayEmit =3D FALSE; > } > diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source= /C/VfrCompile/VfrSyntax.g > index 4c7c6f2..d48072a 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g > @@ -967,11 +967,11 @@ vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR= 8 *TypeName, UINT32 TypeSize, > break; > default: > break; > } > } > - if (TFName !=3D NULL) { delete TFName; TFName =3D NULL; } > + if (TFName !=3D NULL) { delete[] TFName; TFName =3D NULL; } > >> > )* > ) > ; >=20 > @@ -1164,11 +1164,11 @@ vfrStatementVarStoreEfi : > VSEObj.SetVarStor= eId (VarStoreId); >=20 > VSEObj.SetSize ((= UINT16) Size); > VSEObj.SetName (S= toreName); > if (IsUEFI23EfiVa= rstore =3D=3D FALSE && StoreName !=3D NULL) { > - delete StoreNam= e; > + delete[] StoreN= ame; > } > >> > ";" > ; >=20 > @@ -1322,11 +1322,11 @@ vfrQuestionBaseInfo[EFI_VARSTORE_INFO & Info, EFI= _QUESTION_ID & QId, EFI_QUESION > _PCATCH(VFR_RETURN= _FATAL_ERROR); > } > >> > << > if (VarIdStr !=3D = NULL) { > - delete VarIdStr; > + delete[] VarIdSt= r; > } > _SAVE_CURRQEST_VAR= INFO (Info); > >> > ; >=20 > @@ -1509,11 +1509,11 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *= &QuestVarIdStr, BOOLEAN CheckFl > case EFI_VFR_VARS= TORE_NAME: > default: break; > } >=20 > QuestVarIdStr =3D= VarIdStr; > - if (VarStr !=3D N= ULL) {delete VarStr;} > + if (VarStr !=3D N= ULL) {delete[] VarStr;} > >> > ) > ; >=20 > vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&Va= rIdStr, UINT32 &LineNo] : > @@ -4665,11 +4665,11 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] : > } > } > CIfrGet GObj= (L->getLine()); > _SAVE_OPHDR_= COND (GObj, ($ExpOpCount =3D=3D 0), > L->getLine()); > GObj.SetVarI= nfo (&Info); > - delete VarId= Str; > + delete[] Var= IdStr; > $ExpOpCount+= +; > } > >> > ; >=20 > @@ -4839,11 +4839,11 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] : > _PCATCH(= VFR_RETURN_UNSUPPORTED, L->getLine(), > "Get/Set opcode don't support data array"); > } > } > CIfrSet TSOb= j(L->getLine()); > TSObj.SetVar= Info (&Info); > - delete VarId= Str; > + delete[] Var= IdStr; > $ExpOpCount+= +; > } > >> > ; >=20 > @@ -5472,11 +5472,11 @@ EfiVfrParser::_STRCAT ( > return; > } > NewStr[0] =3D '\0'; > if (*Dest !=3D NULL) { > strcpy (NewStr, *Dest); > - delete *Dest; > + delete[] *Dest; > } > strcat (NewStr, Src); >=20 > *Dest =3D NewStr; > } > diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/= Source/C/VfrCompile/VfrUtilityLib.cpp > index c536498..9bdc544 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp > @@ -1,10 +1,10 @@ > /** @file >=20 > Vfr common library functions. >=20 > -Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D License > which accompanies this distribution. The full text of the license may b= e found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -358,11 +358,11 @@ CVfrBufferConfig::Write ( > mItemListPos =3D pItem->mNext; > break; >=20 > case 'i' : // set info > if (mItemListPos->mId !=3D NULL) { > - delete mItemListPos->mId; > + delete[] mItemListPos->mId; > } > mItemListPos->mId =3D NULL; > if (Id !=3D NULL) { > if ((mItemListPos->mId =3D new CHAR8[strlen (Id) + 1]) =3D=3D NULL= ) { > return 2; > @@ -1628,11 +1628,11 @@ SVfrVarStorageNode::~SVfrVarStorageNode ( > if (mVarStoreName !=3D NULL) { > delete[] mVarStoreName; > } >=20 > if (mVarStoreType =3D=3D EFI_VFR_VARSTORE_NAME) { > - delete mStorageInfo.mNameSpace.mNameTable; > + delete[] mStorageInfo.mNameSpace.mNameTable; > } > } >=20 > CVfrDataStorage::CVfrDataStorage ( > VOID > @@ -3487,11 +3487,11 @@ CVfrStringDB::CVfrStringDB () > } >=20 > CVfrStringDB::~CVfrStringDB () > { > if (mStringFileName !=3D NULL) { > - delete mStringFileName; > + delete[] mStringFileName; > } > mStringFileName =3D NULL; > } >=20 >=20 > -- > 1.9.5.msysgit.1