Re: [edk2] [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]

2018-04-17 Thread Dong, Eric
Reviewed-by: Eric Dong 

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

Cc: Eric Dong 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 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

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]

2018-04-10 Thread Dandan Bi
Cc: Eric Dong 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 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

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel