On Thu, Jun 13, 2024 at 02:58:17PM +0200, Marco Felsch wrote: > This is in preparation of buffering fit_open() calls to not load the > same fit twice if it is still open. > > Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> > --- > common/image-fit.c | 4 ++++ > include/image-fit.h | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/common/image-fit.c b/common/image-fit.c > index e93946a0615e..c5c88ebe4c1e 100644 > --- a/common/image-fit.c > +++ b/common/image-fit.c > @@ -951,6 +951,7 @@ struct fit_handle *fit_open(const char *filename, bool verbose, > } > > handle->fit = handle->fit_alloc; > + handle->filename = xstrdup(filename); > > ret = fit_do_open(handle); > if (ret) { > @@ -966,6 +967,9 @@ void fit_close(struct fit_handle *handle) > if (handle->root) > of_delete_node(handle->root); > > + if (handle->filename) > + free(handle->filename); free() handles NULL pointers gracefully, no need to check. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |