summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
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.h
parenta6ac965bca117ef33b38a96c36643b36757b7698 (diff)
downloadedk2-platforms-fd5425230ed22872126b52f22a7294e352ca3349.tar.xz
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.h')
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrUtilityLib.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
index 5faa1f40fd..35d17a031b 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
@@ -33,6 +33,8 @@ extern BOOLEAN VfrCompatibleMode;
#define EFI_BITS_PER_UINT32 (1 << EFI_BITS_SHIFT_PER_UINT32)
#define BUFFER_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete (Buf); } } while (0);
+#define ARRAY_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete[] (Buf); } } while (0);
+
class CVfrBinaryOutput {
public:
@@ -139,7 +141,7 @@ struct SVfrPackStackNode {
~SVfrPackStackNode (VOID) {
if (mIdentifier != NULL) {
- delete mIdentifier;
+ delete[] mIdentifier;
}
mNext = NULL;
}