From 0dbd6e3698b58f60cddb64a0d58a4e23fb5f55d3 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sat, 18 Apr 2020 01:59:11 -0700 Subject: [PATCH] mkimage: fit: Free buf directly in fit_extract_data() 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 --- 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 c37cae3b26..4aeabbcfe9 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -534,8 +534,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.39.5