diff mbox series

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

Message ID 1587200351-12590-3-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit 0dbd6e3698b58f60cddb64a0d58a4e23fb5f55d3
Delegated to: Tom Rini
Headers show
Series [1/3] tools: Remove the out-of-date MinGW support codes | expand

Commit Message

Bin Meng April 18, 2020, 8:59 a.m. UTC
From: Bin Meng <bin.meng@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@windriver.com>
---

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

Comments

Tom Rini April 24, 2020, 5:13 p.m. UTC | #1
On Sat, Apr 18, 2020 at 01:59:11AM -0700, Bin Meng wrote:

> From: Bin Meng <bin.meng@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@windriver.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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;
 }