mkimage: fit: Free buf directly in fit_extract_data()
authorBin Meng <bin.meng@windriver.com>
Sat, 18 Apr 2020 08:59:11 +0000 (01:59 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 24 Apr 2020 14:51:56 +0000 (10:51 -0400)
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@windriver.com>
tools/fit_image.c

index c37cae3b260c6b36738164a5c43a27e6cb604e10..4aeabbcfe97b64f6dd728e1c74f8c904df13bc64 100644 (file)
@@ -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;
 }