From 1880d5e4d0b12695bec02e72e154a415e5085298 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 11 Oct 2016 15:51:09 +0800 Subject: [PATCH] BaseTools/LzmaCompress: Fix file handles not being closed 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/LzmaCompress/LzmaCompress.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c index aff0bed2c8..be87902196 100644 --- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c +++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c @@ -329,8 +329,10 @@ int main2(int numArgs, const char *args[], char *rs) if (InFile_Open(&inStream.file, inputFile) != 0) return PrintError(rs, "Can not open input file"); - if (OutFile_Open(&outStream.file, outputFile) != 0) + if (OutFile_Open(&outStream.file, outputFile) != 0) { + File_Close(&inStream.file); return PrintError(rs, "Can not open output file"); + } File_GetLength(&inStream.file, &fileSize); -- 2.39.2