BaseTools/EfiRom: Fix file handles not being closed
authorHao Wu <hao.a.wu@intel.com>
Fri, 30 Sep 2016 02:41:26 +0000 (10:41 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 8 Nov 2016 08:37:54 +0000 (16:37 +0800)
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>
BaseTools/Source/C/EfiRom/EfiRom.c

index 2e513156001298ce3516d4d32e4c84aa99e7d744..c58c1523e95a5368db4f43217219399faaa71534 100644 (file)
@@ -176,9 +176,6 @@ Returns:
 \r
 BailOut:\r
   if (Status == STATUS_SUCCESS) {\r
-    if (FptrOut != NULL) {\r
-      fclose (FptrOut);\r
-    }\r
     //\r
     // Clean up our file list\r
     //\r
@@ -189,6 +186,10 @@ BailOut:
     }\r
   }\r
 \r
+  if (FptrOut != NULL) {\r
+    fclose (FptrOut);\r
+  }\r
+\r
   if (mOptions.Verbose) {\r
     VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());\r
   }\r