summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-09-27 13:40:58 +0800
committerHao Wu <hao.a.wu@intel.com>2016-11-08 16:37:17 +0800
commitfd5425230ed22872126b52f22a7294e352ca3349 (patch)
tree2a4820e880131f8d83c68deddc064cbfc896e1b1 /BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
parenta6ac965bca117ef33b38a96c36643b36757b7698 (diff)
downloadedk2-fd5425230ed22872126b52f22a7294e352ca3349.tar.gz
edk2-fd5425230ed22872126b52f22a7294e352ca3349.tar.bz2
edk2-fd5425230ed22872126b52f22a7294e352ca3349.zip
BaseTools/VfrCompile: Avoid freeing memory with mismatched functions
Memory allocated by operator new[] should be freed using delete[] to avoid possible memory leak. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp')
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 24b0bfa6fd..1afa5a2590 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -123,7 +123,7 @@ SConfigInfo::~SConfigInfo (
VOID
)
{
- BUFFER_SAFE_FREE (mValue);
+ ARRAY_SAFE_FREE (mValue);
}
SConfigItem::SConfigItem (
@@ -200,9 +200,9 @@ SConfigItem::~SConfigItem (
{
SConfigInfo *Info;
- BUFFER_SAFE_FREE (mName);
- BUFFER_SAFE_FREE (mGuid);
- BUFFER_SAFE_FREE (mId);
+ ARRAY_SAFE_FREE (mName);
+ ARRAY_SAFE_FREE (mGuid);
+ ARRAY_SAFE_FREE (mId);
while (mInfoStrList != NULL) {
Info = mInfoStrList;
mInfoStrList = mInfoStrList->mNext;
@@ -1393,7 +1393,7 @@ SVfrVarStorageNode::~SVfrVarStorageNode (
)
{
if (mVarStoreName != NULL) {
- delete mVarStoreName;
+ delete[] mVarStoreName;
}
if (mVarStoreType == EFI_VFR_VARSTORE_NAME) {
@@ -2102,7 +2102,7 @@ SVfrDefaultStoreNode::~SVfrDefaultStoreNode (
)
{
if (mRefName != NULL) {
- delete mRefName;
+ delete[] mRefName;
}
}
@@ -2304,7 +2304,7 @@ SVfrRuleNode::~SVfrRuleNode (
)
{
if (mRuleName != NULL) {
- delete mRuleName;
+ delete[] mRuleName;
}
}
@@ -2523,11 +2523,11 @@ SVfrQuestionNode::~SVfrQuestionNode (
)
{
if (mName != NULL) {
- delete mName;
+ delete[] mName;
}
if (mVarIdStr != NULL) {
- delete mVarIdStr;
+ delete[] mVarIdStr;
}
}
@@ -3387,7 +3387,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
// Check the String package.
//
if (PkgHeader->Header.Type != EFI_HII_PACKAGE_STRINGS) {
- delete StringPtr;
+ delete[] StringPtr;
return NULL;
}
@@ -3414,7 +3414,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
//
Status = FindStringBlock(Current, StringId, &NameOffset, &BlockType);
if (Status != EFI_SUCCESS) {
- delete StringPtr;
+ delete[] StringPtr;
return NULL;
}
@@ -3447,7 +3447,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
break;
}
- delete StringPtr;
+ delete[] StringPtr;
return VarStoreName;
}