[PATCH master 1/2] FIT: fix double free issue with >1 reference count
Marco Felsch
m.felsch at pengutronix.de
Mon Jan 26 04:03:11 PST 2026
On 26-01-26, Ahmad Fatoum wrote:
> fit_open() was recently changed to be reference counted. When the FIT is
> already open, a handle will be returned with the canonical filename
> being the only allocation incurred.
>
> fit_close() however unconditionally frees the handle without regards to
> the reference count.
>
> Fix this and while at it, fix the memory leak for the canonical filename
> as well.
>
> Reported-by: Claude Sonnet 4.5 <noreply at anthropic.com>
> Fixes: f3aadb274abe ("FIT: add support to cache opened fit images")
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch at pengutronix.de>
More information about the barebox
mailing list