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

Wolfgang Denk wd at denx.de
Wed Nov 24 13:22:26 CET 2021


Dear Mattias Hansson,

In message <20211124121049.24054-1-hansson.mattias at gmail.com> you wrote:
> 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>

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Time is a drug. Too much of it kills you.
                                      - Terry Pratchett, _Small Gods_


More information about the U-Boot mailing list