From 076947cfceaa5c87f18306bd29b22caaa392d2f5 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 11 Oct 2016 15:24:15 +0800 Subject: [PATCH] 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 --- BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) { -- 2.39.2