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>
This commit is contained in:
@@ -56,13 +56,13 @@ SPendingAssign::~SPendingAssign (
|
||||
)
|
||||
{
|
||||
if (mKey != NULL) {
|
||||
delete mKey;
|
||||
delete[] mKey;
|
||||
}
|
||||
mAddr = NULL;
|
||||
mLen = 0;
|
||||
mLineNo = 0;
|
||||
if (mMsg != NULL) {
|
||||
delete mMsg;
|
||||
delete[] mMsg;
|
||||
}
|
||||
mNext = NULL;
|
||||
}
|
||||
@@ -898,7 +898,7 @@ CFormPkg::DeclarePendingQuestion (
|
||||
strcpy (NewStr, SName);
|
||||
strcat (NewStr, VarStr + strlen (FName));
|
||||
ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (NewStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);
|
||||
delete NewStr;
|
||||
delete[] NewStr;
|
||||
}
|
||||
} else {
|
||||
ReturnCode = VFR_RETURN_UNSUPPORTED;
|
||||
|
Reference in New Issue
Block a user