From: Hao Wu Date: Tue, 11 Oct 2016 07:24:15 +0000 (+0800) Subject: BaseTools/TianoCompress: Fix potential memory leak X-Git-Tag: edk2-stable201903~5315 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=076947cfceaa5c87f18306bd29b22caaa392d2f5 BaseTools/TianoCompress: Fix potential memory leak Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Liming Gao --- diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c index 93cb6c3ac3..44dbccf9ad 100644 --- a/BaseTools/Source/C/TianoCompress/TianoCompress.c +++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c @@ -1906,7 +1906,7 @@ Returns: FileBuffer = (UINT8 *) malloc (InputLength); if (FileBuffer == NULL) { Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!"); - return 1; + goto ERROR; } Status = GetFileContents ( @@ -1917,8 +1917,8 @@ Returns: } if (EFI_ERROR(Status)) { - free(FileBuffer); - return 1; + Error (NULL, 0, 0004, "Error getting contents of file: %s", InputFileName); + goto ERROR; } if (OutputFileName == NULL) {