From: "Gao, Liming" <liming.gao@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>
Subject: Re: [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[]
Date: Fri, 23 Mar 2018 06:56:35 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1EC02A@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1519710827-11228-1-git-send-email-dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: Bi, Dandan
> Sent: Tuesday, February 27, 2018 1:54 PM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [patch 1/2] 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>
> ---
> 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.<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
> 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.<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
> 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
prev parent reply other threads:[~2018-03-23 6:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 5:53 [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
2018-02-27 5:53 ` [patch 2/2] BaseTool/VfrCompile: Fix potential memory leak issue Dandan Bi
2018-03-23 6:56 ` Gao, Liming
2018-03-23 6:56 ` Gao, Liming [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E1EC02A@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox