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.fel...@pengutronix.de>
---
 common/image-fit.c  | 5 +++--
 include/image-fit.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 
1cb407d4d86cb3d0a643149bb08c46caadcd56fe..e4b0a8bd5d1a7283239556dd4532eccd5333e90a
 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1005,9 +1005,8 @@ struct fit_handle *fit_open(const char *_filename, bool 
verbose,
                return ERR_PTR(ret);
        }
 
-       free(filename);
-
        handle->fit = handle->fit_alloc;
+       handle->filename = filename;
 
        ret = fit_do_open(handle);
        if (ret) {
@@ -1022,6 +1021,8 @@ static void __fit_close(struct fit_handle *handle)
 {
        if (handle->root)
                of_delete_node(handle->root);
+
+       free(handle->filename);
        free(handle->fit_alloc);
 }
 
diff --git a/include/image-fit.h b/include/image-fit.h
index 
f8321aa87e11fcea642593e790a37df72a2e93b1..68f70f4365cb7a650596263086f7de2209d5957e
 100644
--- a/include/image-fit.h
+++ b/include/image-fit.h
@@ -13,6 +13,7 @@ struct fit_handle {
        const void *fit;
        void *fit_alloc;
        size_t size;
+       char *filename;
 
        bool verbose;
        enum bootm_verify verify;

-- 
2.39.5


Reply via email to