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.93; helo=mga11.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 D669A20955F07 for ; Mon, 26 Feb 2018 21:48:03 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 21:54:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,398,1515484800"; d="scan'208";a="178351758" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga004.jf.intel.com with ESMTP; 26 Feb 2018 21:54:07 -0800 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Eric Dong , Liming Gao Date: Tue, 27 Feb 2018 13:53:46 +0800 Message-Id: <1519710827-11228-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [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: Tue, 27 Feb 2018 05:48:04 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=764 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(-) diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/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 VfrCompiler main class and main function. -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 BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -282,11 +282,11 @@ CVfrCompiler::AppendIncludePath ( strcat (IncludePaths, mOptions.IncludePaths); } strcat (IncludePaths, " -I "); strcat (IncludePaths, PathStr); if (mOptions.IncludePaths != NULL) { - delete mOptions.IncludePaths; + delete[] mOptions.IncludePaths; } mOptions.IncludePaths = IncludePaths; } VOID @@ -311,11 +311,11 @@ CVfrCompiler::AppendCPreprocessorOptions ( strcat (Opt, mOptions.CPreprocessorOptions); } strcat (Opt, " "); strcat (Opt, Options); if (mOptions.CPreprocessorOptions != NULL) { - delete mOptions.CPreprocessorOptions; + delete[] mOptions.CPreprocessorOptions; } mOptions.CPreprocessorOptions = Opt; } INT8 @@ -529,16 +529,16 @@ CVfrCompiler::~CVfrCompiler ( free (mOptions.RecordListFile); mOptions.RecordListFile = NULL; } if (mOptions.IncludePaths != NULL) { - delete mOptions.IncludePaths; + delete[] mOptions.IncludePaths; mOptions.IncludePaths = NULL; } if (mOptions.CPreprocessorOptions != NULL) { - delete mOptions.CPreprocessorOptions; + delete[] mOptions.CPreprocessorOptions; mOptions.CPreprocessorOptions = NULL; } SET_RUN_STATUS(STATUS_DEAD); } @@ -963,15 +963,15 @@ main ( if ((Status == STATUS_DEAD) || (Status == STATUS_FAILED)) { return 2; } if (gCBuffer.Buffer != NULL) { - delete gCBuffer.Buffer; + delete[] gCBuffer.Buffer; } if (gRBuffer.Buffer != NULL) { - delete gRBuffer.Buffer; + delete[] gRBuffer.Buffer; } return GetUtilityStatus (); } diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/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 = NULL; if (mInputFileName != NULL) { - delete mInputFileName; + delete[] mInputFileName; } while (mScopeRecordListHead != NULL) { pNode = mScopeRecordListHead; mScopeRecordListHead = mScopeRecordListHead->mNext; diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/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 () while (mBufferNodeQueueHead != NULL) { pBNode = mBufferNodeQueueHead; mBufferNodeQueueHead = mBufferNodeQueueHead->mNext; if (pBNode->mBufferStart != NULL) { - delete pBNode->mBufferStart; + delete[] pBNode->mBufferStart; delete pBNode; } } mBufferNodeQueueTail = NULL; mCurrBufferNode = NULL; @@ -1150,11 +1150,11 @@ CIfrRecordInfoDB::IfrRecordOutput ( { CHAR8 *Temp; SIfrRecord *pNode; if (TBuffer.Buffer != NULL) { - delete TBuffer.Buffer; + delete[] TBuffer.Buffer; } TBuffer.Size = 0; TBuffer.Buffer = NULL; @@ -2257,11 +2257,11 @@ CIfrObj::_EMIT_PENDING_OBJ ( // // update bin buffer to package data buffer // if (mObjBinBuf != NULL) { - delete mObjBinBuf; + delete[] mObjBinBuf; mObjBinBuf = ObjBinBuf; } mDelayEmit = 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, CHAR8 *TypeName, UINT32 TypeSize, break; default: break; } } - if (TFName != NULL) { delete TFName; TFName = NULL; } + if (TFName != NULL) { delete[] TFName; TFName = NULL; } >> )* ) ; @@ -1164,11 +1164,11 @@ vfrStatementVarStoreEfi : VSEObj.SetVarStoreId (VarStoreId); VSEObj.SetSize ((UINT16) Size); VSEObj.SetName (StoreName); if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) { - delete StoreName; + delete[] StoreName; } >> ";" ; @@ -1322,11 +1322,11 @@ vfrQuestionBaseInfo[EFI_VARSTORE_INFO & Info, EFI_QUESTION_ID & QId, EFI_QUESION _PCATCH(VFR_RETURN_FATAL_ERROR); } >> << if (VarIdStr != NULL) { - delete VarIdStr; + delete[] VarIdStr; } _SAVE_CURRQEST_VARINFO (Info); >> ; @@ -1509,11 +1509,11 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl case EFI_VFR_VARSTORE_NAME: default: break; } QuestVarIdStr = VarIdStr; - if (VarStr != NULL) {delete VarStr;} + if (VarStr != NULL) {delete[] VarStr;} >> ) ; vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr, UINT32 &LineNo] : @@ -4665,11 +4665,11 @@ getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] : } } CIfrGet GObj(L->getLine()); _SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine()); GObj.SetVarInfo (&Info); - delete VarIdStr; + delete[] VarIdStr; $ExpOpCount++; } >> ; @@ -4839,11 +4839,11 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] : _PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array"); } } CIfrSet TSObj(L->getLine()); TSObj.SetVarInfo (&Info); - delete VarIdStr; + delete[] VarIdStr; $ExpOpCount++; } >> ; @@ -5472,11 +5472,11 @@ EfiVfrParser::_STRCAT ( return; } NewStr[0] = '\0'; if (*Dest != NULL) { strcpy (NewStr, *Dest); - delete *Dest; + delete[] *Dest; } strcat (NewStr, Src); *Dest = 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 Vfr common library functions. -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 BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -358,11 +358,11 @@ CVfrBufferConfig::Write ( mItemListPos = pItem->mNext; break; case 'i' : // set info if (mItemListPos->mId != NULL) { - delete mItemListPos->mId; + delete[] mItemListPos->mId; } mItemListPos->mId = NULL; if (Id != NULL) { if ((mItemListPos->mId = new CHAR8[strlen (Id) + 1]) == NULL) { return 2; @@ -1628,11 +1628,11 @@ SVfrVarStorageNode::~SVfrVarStorageNode ( if (mVarStoreName != NULL) { delete[] mVarStoreName; } if (mVarStoreType == EFI_VFR_VARSTORE_NAME) { - delete mStorageInfo.mNameSpace.mNameTable; + delete[] mStorageInfo.mNameSpace.mNameTable; } } CVfrDataStorage::CVfrDataStorage ( VOID @@ -3487,11 +3487,11 @@ CVfrStringDB::CVfrStringDB () } CVfrStringDB::~CVfrStringDB () { if (mStringFileName != NULL) { - delete mStringFileName; + delete[] mStringFileName; } mStringFileName = NULL; } -- 1.9.5.msysgit.1