From: Hao Wu Date: Tue, 11 Oct 2016 07:51:09 +0000 (+0800) Subject: BaseTools/LzmaCompress: Fix file handles not being closed X-Git-Tag: edk2-stable201903~5307 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=1880d5e4d0b12695bec02e72e154a415e5085298;hp=181c95593741b0d10e1cf52f21d2c86669900369 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 --- 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);