From 8d283231c9193a9e7c754fe0b03da9bf96d9bf05 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Thu, 3 May 2018 15:05:09 +0100 Subject: [PATCH] tools/fiptool: fix memory leaks in fiptool Free desc->image->buffer before freeing desc->image. We make sure that the desc->image is non-null before attempting this. Change-Id: I35c5674629a41d7cf1a78b7b41ca4b930d0fb688 Signed-off-by: Jonathan Wright --- tools/fiptool/fiptool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c index e70ff364..e4348ee8 100644 --- a/tools/fiptool/fiptool.c +++ b/tools/fiptool/fiptool.c @@ -169,7 +169,10 @@ static void free_image_desc(image_desc_t *desc) free(desc->name); free(desc->cmdline_name); free(desc->action_arg); - free(desc->image); + if (desc->image) { + free(desc->image->buffer); + free(desc->image); + } free(desc); } -- 2.30.2