summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJinyang He <hejinyang@loongson.cn>2020-07-10 17:11:44 +0800
committerSimon Horman <horms@verge.net.au>2020-08-10 13:48:47 +0200
commit24884d12d0a494b59c534af3ef067d7f7a0e075f (patch)
tree3711865e0b618763e7943ca6069ef4850778bf1b
parent12e643a7dc65cc6d70f6d207867b6db943c6138b (diff)
downloadkexec-tools-24884d12d0a494b59c534af3ef067d7f7a0e075f.tar.gz
mips: kexec-elf-mips: fix not free in elf_mips_load()
In the function elf_mips_load(), crash_cmdline was alloced memory. But it seems to forget to free it when last used at line 131. Signed-off-by: Jinyang He <hejinyang@loongson.cn> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/mips/kexec-elf-mips.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c
index 849a7bad..cf908799 100644
--- a/kexec/arch/mips/kexec-elf-mips.c
+++ b/kexec/arch/mips/kexec-elf-mips.c
@@ -129,9 +129,12 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
if (arch_options.command_line)
strncat(cmdline_buf, arch_options.command_line, command_line_len);
if (crash_cmdline)
+ {
strncat(cmdline_buf, crash_cmdline,
sizeof(crash_cmdline) -
strlen(crash_cmdline) - 1);
+ free(crash_cmdline);
+ }
if (info->kexec_flags & KEXEC_ON_CRASH)
/* In case of crashdump segment[0] is kernel.