summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2017-09-14 09:01:38 +0300
committerIngo Molnar <mingo@kernel.org>2017-09-15 12:31:43 +0300
commit0998b7a0befdf6e734032895ee639a5e6f88cc3f (patch)
treefda8a97eb48ba960ff57e74bd04bc47e7d7fc78c /tools
parent711aab1dbb324d321e3d84368a435a78908c7bce (diff)
downloadlinux-0998b7a0befdf6e734032895ee639a5e6f88cc3f.tar.xz
objtool: Fix memory leak in elf_create_rela_section()
Let's free the allocated char array 'relaname' before returning, in order to avoid leaking memory. Signed-off-by: Martin Kepplinger <martink@posteo.de> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: mingo.kernel.org@gmail.com Link: http://lkml.kernel.org/r/20170914060138.26472-1-martink@posteo.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/objtool/elf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 6e9f980a7d26..1e89a5f8bfc9 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -508,6 +508,7 @@ struct section *elf_create_rela_section(struct elf *elf, struct section *base)
strcat(relaname, base->name);
sec = elf_create_section(elf, relaname, sizeof(GElf_Rela), 0);
+ free(relaname);
if (!sec)
return NULL;