All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry
@ 2020-04-27 13:35 Gustavo A. R. Silva
  2020-04-27 14:44 ` Josh Poimboeuf
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-04-27 13:35 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel, 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 <gustavo@embeddedor.com>
---
 tools/objtool/orc_gen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
index 4c0dabd28000..07b67b1576d7 100644
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -120,6 +120,7 @@ static int create_orc_entry(struct elf *elf, struct section *u_sec, struct secti
 		if (!rela->sym) {
 			WARN("missing symbol for insn at offset 0x%lx\n",
 			     insn_off);
+			free(rela);
 			return -1;
 		}
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-27 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 13:35 [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry Gustavo A. R. Silva
2020-04-27 14:44 ` Josh Poimboeuf
2020-04-27 17:28   ` Gustavo A. R. Silva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.