From 472aa1665eb82f092d0fdc3703f0d553f26cdc5b Mon Sep 17 00:00:00 2001 From: shchmue Date: Fri, 25 Oct 2019 11:44:51 -0600 Subject: [PATCH] sept: Prevent memory leak --- source/hos/sept.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/hos/sept.c b/source/hos/sept.c index 22814db..1858533 100644 --- a/source/hos/sept.c +++ b/source/hos/sept.c @@ -107,8 +107,10 @@ int reboot_to_sept(const u8 *tsec_fw, const u32 tsec_size, const u32 kb) tmp_cfg->boot_cfg |= BOOT_CFG_SEPT_RUN; - if (f_open(&fp, "sd:/sept/payload.bin", FA_READ | FA_WRITE)) + if (f_open(&fp, "sd:/sept/payload.bin", FA_READ | FA_WRITE)) { + free(tmp_cfg); goto error; + } f_lseek(&fp, PATCHED_RELOC_SZ); f_write(&fp, tmp_cfg, sizeof(boot_cfg_t), NULL);