Free the handle if read_file_2() fails. Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- 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