lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] objtool: Fix memory leakage
Date
This commit fixes potential memory leakage in
elf_create_section_symbol() function.

Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
---
tools/objtool/elf.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 7e24b09b1163..58f30840358f 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -776,6 +776,7 @@ elf_create_section_symbol(struct elf *elf, struct section *sec)

if (elf_update_symbol(elf, symtab, symtab_shndx, old)) {
WARN("elf_update_symbol move");
+ free(sym);
return NULL;
}

@@ -785,6 +786,7 @@ elf_create_section_symbol(struct elf *elf, struct section *sec)
sym->idx = new_idx;
if (elf_update_symbol(elf, symtab, symtab_shndx, sym)) {
WARN("elf_update_symbol");
+ free(sym);
return NULL;
}

--
2.25.1
\
 
 \ /
  Last update: 2022-11-30 11:47    [W:0.030 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site