diff options
author | Jinyang He <hejinyang@loongson.cn> | 2020-07-10 17:11:44 +0800 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2020-08-10 13:48:47 +0200 |
commit | 24884d12d0a494b59c534af3ef067d7f7a0e075f (patch) | |
tree | 3711865e0b618763e7943ca6069ef4850778bf1b | |
parent | 12e643a7dc65cc6d70f6d207867b6db943c6138b (diff) |
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.c | 3 |
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 849a7ba..cf90879 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. |