[PATCH v3 01/10] FIT: fix missing free in fit_open error path

Marco Felsch m.felsch at pengutronix.de
Wed Jul 3 09:58:29 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