BaseTool/VfrCompile: make delete[] match with new[]

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=764

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Bi, Dandan 2018-02-27 13:53:46 +08:00 committed by Liming Gao
parent 0a4f2d4869
commit f7e9858102
5 changed files with 22 additions and 22 deletions

View File

@ -2,7 +2,7 @@
VfrCompiler main class and main function.
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
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
@ -284,7 +284,7 @@ CVfrCompiler::AppendIncludePath (
strcat (IncludePaths, " -I ");
strcat (IncludePaths, PathStr);
if (mOptions.IncludePaths != NULL) {
delete mOptions.IncludePaths;
delete[] mOptions.IncludePaths;
}
mOptions.IncludePaths = IncludePaths;
}
@ -313,7 +313,7 @@ CVfrCompiler::AppendCPreprocessorOptions (
strcat (Opt, " ");
strcat (Opt, Options);
if (mOptions.CPreprocessorOptions != NULL) {
delete mOptions.CPreprocessorOptions;
delete[] mOptions.CPreprocessorOptions;
}
mOptions.CPreprocessorOptions = Opt;
}
@ -531,12 +531,12 @@ CVfrCompiler::~CVfrCompiler (
}
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;
}
@ -965,11 +965,11 @@ main (
}
if (gCBuffer.Buffer != NULL) {
delete gCBuffer.Buffer;
delete[] gCBuffer.Buffer;
}
if (gRBuffer.Buffer != NULL) {
delete gRBuffer.Buffer;
delete[] gRBuffer.Buffer;
}
return GetUtilityStatus ();

View File

@ -77,7 +77,7 @@ CVfrErrorHandle::~CVfrErrorHandle (
SVfrFileScopeRecord *pNode = NULL;
if (mInputFileName != NULL) {
delete mInputFileName;
delete[] mInputFileName;
}
while (mScopeRecordListHead != NULL) {

View File

@ -144,7 +144,7 @@ CFormPkg::~CFormPkg ()
pBNode = mBufferNodeQueueHead;
mBufferNodeQueueHead = mBufferNodeQueueHead->mNext;
if (pBNode->mBufferStart != NULL) {
delete pBNode->mBufferStart;
delete[] pBNode->mBufferStart;
delete pBNode;
}
}
@ -1152,7 +1152,7 @@ CIfrRecordInfoDB::IfrRecordOutput (
SIfrRecord *pNode;
if (TBuffer.Buffer != NULL) {
delete TBuffer.Buffer;
delete[] TBuffer.Buffer;
}
TBuffer.Size = 0;
@ -2259,7 +2259,7 @@ CIfrObj::_EMIT_PENDING_OBJ (
// update bin buffer to package data buffer
//
if (mObjBinBuf != NULL) {
delete mObjBinBuf;
delete[] mObjBinBuf;
mObjBinBuf = ObjBinBuf;
}

View File

@ -969,7 +969,7 @@ vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize,
break;
}
}
if (TFName != NULL) { delete TFName; TFName = NULL; }
if (TFName != NULL) { delete[] TFName; TFName = NULL; }
>>
)*
)
@ -1166,7 +1166,7 @@ vfrStatementVarStoreEfi :
VSEObj.SetSize ((UINT16) Size);
VSEObj.SetName (StoreName);
if (IsUEFI23EfiVarstore == FALSE && StoreName != NULL) {
delete StoreName;
delete[] StoreName;
}
>>
";"
@ -1324,7 +1324,7 @@ vfrQuestionBaseInfo[EFI_VARSTORE_INFO & Info, EFI_QUESTION_ID & QId, EFI_QUESION
>>
<<
if (VarIdStr != NULL) {
delete VarIdStr;
delete[] VarIdStr;
}
_SAVE_CURRQEST_VARINFO (Info);
>>
@ -1511,7 +1511,7 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
}
QuestVarIdStr = VarIdStr;
if (VarStr != NULL) {delete VarStr;}
if (VarStr != NULL) {delete[] VarStr;}
>>
)
;
@ -4667,7 +4667,7 @@ 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++;
}
>>
@ -4841,7 +4841,7 @@ setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
}
CIfrSet TSObj(L->getLine());
TSObj.SetVarInfo (&Info);
delete VarIdStr;
delete[] VarIdStr;
$ExpOpCount++;
}
>>
@ -5474,7 +5474,7 @@ EfiVfrParser::_STRCAT (
NewStr[0] = '\0';
if (*Dest != NULL) {
strcpy (NewStr, *Dest);
delete *Dest;
delete[] *Dest;
}
strcat (NewStr, Src);

View File

@ -2,7 +2,7 @@
Vfr common library functions.
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
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
@ -360,7 +360,7 @@ CVfrBufferConfig::Write (
case 'i' : // set info
if (mItemListPos->mId != NULL) {
delete mItemListPos->mId;
delete[] mItemListPos->mId;
}
mItemListPos->mId = NULL;
if (Id != NULL) {
@ -1630,7 +1630,7 @@ SVfrVarStorageNode::~SVfrVarStorageNode (
}
if (mVarStoreType == EFI_VFR_VARSTORE_NAME) {
delete mStorageInfo.mNameSpace.mNameTable;
delete[] mStorageInfo.mNameSpace.mNameTable;
}
}
@ -3489,7 +3489,7 @@ CVfrStringDB::CVfrStringDB ()
CVfrStringDB::~CVfrStringDB ()
{
if (mStringFileName != NULL) {
delete mStringFileName;
delete[] mStringFileName;
}
mStringFileName = NULL;
}