[PATCH 3/3] mkimage: fit: Free buf directly in fit_extract_data()

Bin Meng bmeng.cn at gmail.com
Sat Apr 18 10:59:11 CEST 2020


From: Bin Meng <bin.meng at windriver.com>

If given ptr to free() is NULL, no operation is performed.
Hence we can just free buf directly in fit_extract_data().

Signed-off-by: Bin Meng <bin.meng at windriver.com>
---

 tools/fit_image.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 05c1f00..965061d 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -527,8 +527,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 err_munmap:
 	munmap(fdt, sbuf.st_size);
 err:
-	if (buf)
-		free(buf);
+	free(buf);
 	close(fd);
 	return ret;
 }
-- 
2.7.4



More information about the U-Boot mailing list