summaryrefslogtreecommitdiff
path: root/BaseTools
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-10-11 15:51:09 +0800
committerHao Wu <hao.a.wu@intel.com>2016-11-08 16:38:07 +0800
commit1880d5e4d0b12695bec02e72e154a415e5085298 (patch)
tree8d866ab0e5c25f2ffea7ee0d8d8ef26a334251fa /BaseTools
parent181c95593741b0d10e1cf52f21d2c86669900369 (diff)
downloadedk2-1880d5e4d0b12695bec02e72e154a415e5085298.zip
edk2-1880d5e4d0b12695bec02e72e154a415e5085298.tar.gz
edk2-1880d5e4d0b12695bec02e72e154a415e5085298.tar.bz2
BaseTools/LzmaCompress: Fix file handles not being closed
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>
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/C/LzmaCompress/LzmaCompress.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
index aff0bed..be87902 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);