Free the handle if read_file_2() fails.

Reviewed-by: Ahmad Fatoum <a.fat...@pengutronix.de>
Signed-off-by: Marco Felsch <m.fel...@pengutronix.de>
---
 common/image-fit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/image-fit.c b/common/image-fit.c
index 
5006394eb7bbd0873a37a0102d5a0d89ea7c6b9f..4d5c5bfe12472af85b26cd1ee93e7c99316b283c
 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -977,6 +977,7 @@ struct fit_handle *fit_open(const char *filename, bool 
verbose,
                          max_size);
        if (ret && ret != -EFBIG) {
                pr_err("unable to read %s: %pe\n", filename, ERR_PTR(ret));
+               free(handle);
                return ERR_PTR(ret);
        }
 

-- 
2.39.5


Reply via email to