Skip to content

Commit 0998b7a

Browse files
mergeIngo Molnar
authored andcommitted
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 <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 711aab1 commit 0998b7a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/objtool/elf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ struct section *elf_create_rela_section(struct elf *elf, struct section *base)
508508
strcat(relaname, base->name);
509509

510510
sec = elf_create_section(elf, relaname, sizeof(GElf_Rela), 0);
511+
free(relaname);
511512
if (!sec)
512513
return NULL;
513514

0 commit comments

Comments
 (0)