objtool: orc_gen: Fix memory leak in create_orc_entry
PATCH 1/1 objtool: orc_gen: Fix memory leak in create_orc_entry
In case memory resources for rela were allocated, release them before return.
Addresses-Coverity-ID: 1462331 ("Resource leak")
--- tools/objtool/orc_gen.c | 1 + 1 file changed, 1 insertion(+)
tools/objtool/orc_gen.c +1 -0
@@ -120,6 +120,7 @@ static int create_orc_entry(struct elf *elf, struct section *u_sec, struct sectiif (!rela->sym) {WARN ("missing symbol for insn at offset 0x%lx\n" , insn_off); +free (rela);return -1 ; }
Signature · 1 line
2.26.0
Quoted 6 lines · Gustavo A. R. Silva
In case memory resources for rela were allocated, release them before return.
Addresses-Coverity-ID: 1462331 ("Resource leak")
Fixes e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")Signed-off-by Gustavo A. R. Silva <[email protected]>
Hi Gustavo,
For performance reasons, our policy is to allow memory leaks in error and exit paths. So you may want to turn off Coverity resource leak checking for objtool.
Signature · 1 line
Josh
Hi Josh,
Quoted 8 lines · Josh Poimboeuf
Quoted 6 lines · Gustavo A. R. Silva
In case memory resources for rela were allocated, release them before return.
Addresses-Coverity-ID: 1462331 ("Resource leak")
Fixes e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")Signed-off-by Gustavo A. R. Silva <[email protected]>
Quoted 6 lines
Hi Gustavo,
For performance reasons, our policy is to allow memory leaks in error and exit paths. So you may want to turn off Coverity resource leak checking for objtool.
Got it. That's good to know.
Thank you.
--
Gustavo