Skip to contentSkip to conversation

tools: imximage: Fix potential memory leak

PATCH Applied Maks Mishin 2 participants 2 messages Jan 31, 2025 – Feb 27, 2025 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: imximage: Fix potential memory leak

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

---
 tools/imximage.c | 1 +
 1 file changed, 1 insertion(+)
tools/imximage.c +1 -0
index 467d9f27d2..55231caf8f 100644
@@ -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 */
Signature · 1 line
2.34.1
reviewer Applied
#1 lore raw
Quoted 5 lines · Maks Mishin

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

Applied, thanks.