[PATCH v2] tools/mxsimage: Remove fclose on empty FILE pointer

sbabic at denx.de sbabic at denx.de
Sat Feb 5 17:38:59 CET 2022

> 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 at gmail.com>
> Reviewed-by: Wolfgang Denk <wd at denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de

More information about the U-Boot mailing list