[PATCH] tools: imximage: Fix potential memory leak

Maks Mishin maks.mishinfz at gmail.com
Fri Jan 31 11:04:46 CET 2025


Dynamic memory, referenced by 'line', is allocated at imximage.c:761 
by calling function 'getline' and lost at imximage.c:793.

Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
---
 tools/imximage.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/imximage.c b/tools/imximage.c
index 467d9f27d2..55231caf8f 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -783,6 +783,7 @@ static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name)
 	}
 
 	(*set_dcd_rst)(imxhdr, dcd_len, name, lineno);
+	free(line);
 	fclose(fd);
 
 	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
-- 
2.34.1



More information about the U-Boot mailing list