[PATCH] tools: fix handle leak in ifdtool.c

Anton Moryakov ant.v.moryakov at gmail.com
Mon May 19 10:51:59 CEST 2025


Maybe. However, the static analyser did not swear at others


Пн, 19 мая 2025 г. в 11:47, Quentin Schulz <quentin.schulz at cherry.de>:

> Hi Anton,
>
> On 5/16/25 5:25 PM, ant.v.moryakov at gmail.com wrote:
> > From: Anton Moryakov <ant.v.moryakov at gmail.com>
> >
> > Prevent file descriptor leaks by properly closing 'fd' and 'new_fd'
> > when fstat() or write() operations fail.
> >
> > - Added close(fd) before return in open_for_read() if fstat() fails.
> > - Added close(new_fd) before return in write_image() if write() fails.
> > - No close needed if open() fails (fd == -1 is invalid).
> >
> > Signed-off-by: Anton Moryakov <ant.v.moryakov at gmail.com>
>
> Looks fine to me
>
> Reviewed-by: Quentin Schulz <quentin.schulz at cherry.de>
>
> I believe there are a few others in that file?
>
> inject_region returns without closing, same for write_data, same for the
> main function with bios_fd at the very least.
>
> Thanks!
> Quentin
>


More information about the U-Boot mailing list