summaryrefslogtreecommitdiffstats
path: root/utils/imxtools/sbtools/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imxtools/sbtools/misc.c')
-rw-r--r--utils/imxtools/sbtools/misc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/imxtools/sbtools/misc.c b/utils/imxtools/sbtools/misc.c
index 68c769808b..71b3cb600b 100644
--- a/utils/imxtools/sbtools/misc.c
+++ b/utils/imxtools/sbtools/misc.c
@@ -308,7 +308,7 @@ void color(color_t c)
enum sb_version_guess_t guess_sb_version(const char *filename)
{
-#define ret(x) do { fclose(f); return x; } while(0)
+#define ret(x) do { if(f) fclose(f); return x; } while(0)
FILE *f = fopen(filename, "rb");
if(f == NULL)
ret(SB_VERSION_ERR);