Reviewed-by: Eric Dong <eric.d...@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.d...@intel.com>; Gao, Liming <liming....@intel.com>
Subject: [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]

Cc: Eric Dong <eric.d...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan...@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

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

Reply via email to