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:
Hao Wu
2016-09-27 13:40:58 +08:00
parent a6ac965bca
commit fd5425230e
5 changed files with 22 additions and 20 deletions

View File

@ -677,7 +677,7 @@ CVfrCompiler::PreProcess (
goto Fail;
}
delete PreProcessCmd;
delete[] PreProcessCmd;
Out:
SET_RUN_STATUS (STATUS_PREPROCESSED);
@ -687,7 +687,7 @@ Fail:
if (!IS_RUN_STATUS(STATUS_DEAD)) {
SET_RUN_STATUS (STATUS_FAILED);
}
delete PreProcessCmd;
delete[] PreProcessCmd;
}
extern UINT8 VfrParserStart (IN FILE *, IN INPUT_INFO_TO_SYNTAX *);