tools/mxsimage: Remove fclose on empty FILE pointer
authorMattias Hansson <hansson.mattias@gmail.com>
Wed, 24 Nov 2021 12:10:49 +0000 (13:10 +0100)
committerStefano Babic <sbabic@denx.de>
Sat, 5 Feb 2022 12:38:39 +0000 (13:38 +0100)
commiteb1c716c6dd14e8fe97ea9a1a2211c27edf3cfb2
tree630d9165b5ed9fdd0d422ec929f946d66d607167
parentc4c1ed68c1e85ed3100840e395d40294d38f5f7c
tools/mxsimage: Remove fclose on empty FILE pointer

If `sb_load_cmdfile()` fails to open the configuration file it will jump
to error handling where the code will try to `fclose()` the FILE pointer
which is NULL causing `mkimage` to segfault.

This patch removes the label for error handling and instead returns
immediately which skips the `fclose()` and prevents the segfault. The
errno is also described in the error message to guide users.

Signed-off-by: Mattias Hansson <hansson.mattias@gmail.com>
Reviewed-by: Wolfgang Denk <wd@denx.de>
tools/mxsimage.c