public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dong, Eric" <eric.dong@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]
Date: Tue, 17 Apr 2018 08:17:22 +0000	[thread overview]
Message-ID: <ED077930C258884BBCB450DB737E66224AB7BB7F@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20180410075447.121560-2-dandan.bi@intel.com>

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Bi, Dandan 
Sent: Tuesday, April 10, 2018 3:55 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]

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/VfrUtilityLib.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 5cab7bbfa1a..d795ef01bda 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3038,11 +3038,12 @@ CVfrQuestionDB::RegisterNewDateQuestion (
   pNode[2]->mNext       = mQuestionList;
   mQuestionList         = pNode[0];
 
   for (Index = 0; Index < 3; Index++) {
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
   gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID)); @@ -3055,11 +3056,12 @@ Err:
     if (pNode[Index] != NULL) {
       delete pNode[Index];
     }
 
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr [Index];
+      VarIdStr [Index] = NULL;
     }
   }
 }
 
 VOID
@@ -3214,11 +3216,12 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
   pNode[2]->mNext       = mQuestionList;
   mQuestionList         = pNode[0];
 
   for (Index = 0; Index < 3; Index++) {
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
   gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID)); @@ -3231,11 +3234,12 @@ Err:
     if (pNode[Index] != NULL) {
       delete pNode[Index];
     }
 
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 }
 
 VOID
--
2.14.3.windows.1



  reply	other threads:[~2018-04-17  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  7:54 [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dandan Bi
2018-04-10  7:54 ` [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
2018-04-17  8:17   ` Dong, Eric [this message]
2018-04-17  8:17 ` [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dong, Eric
2018-05-08  9:45 ` Gary Lin
2018-05-08 11:50   ` Bi, Dandan
2018-05-09  1:48     ` Gary Lin

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=ED077930C258884BBCB450DB737E66224AB7BB7F@SHSMSX101.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