[PATCH v2 01/11] FIT: fix missing free in fit_open error path

Marco Felsch m.felsch at pengutronix.de
Thu Jun 13 05:58:08 PDT 2024


Free the handle if read_file_2() fails.

Signed-off-by: Marco Felsch <m.felsch at 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 251fda97b3fc..008804e6a6c3 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -922,6 +922,7 @@ struct fit_handle *fit_open(const char *filename, bool verbose,
 			  max_size);
 	if (ret && ret != -EFBIG) {
 		pr_err("unable to read %s: %s\n", filename, strerror(-ret));
+		free(handle);
 		return ERR_PTR(ret);
 	}
 
-- 
2.39.2




More information about the barebox mailing list