BaseTools/TianoCompress: Fix potential memory leak

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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-10-11 15:24:15 +08:00
parent b14f278de4
commit 076947cfce
1 changed files with 3 additions and 3 deletions

View File

@ -1906,7 +1906,7 @@ Returns:
FileBuffer = (UINT8 *) malloc (InputLength); FileBuffer = (UINT8 *) malloc (InputLength);
if (FileBuffer == NULL) { if (FileBuffer == NULL) {
Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!"); Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
return 1; goto ERROR;
} }
Status = GetFileContents ( Status = GetFileContents (
@ -1917,8 +1917,8 @@ Returns:
} }
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
free(FileBuffer); Error (NULL, 0, 0004, "Error getting contents of file: %s", InputFileName);
return 1; goto ERROR;
} }
if (OutputFileName == NULL) { if (OutputFileName == NULL) {