From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry
Date: Mon, 27 Apr 2020 08:35:33 -0500 [thread overview]
Message-ID: <20200427133533.GA20830@embeddedor> (raw)
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
next reply other threads:[~2020-04-27 13:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 13:35 Gustavo A. R. Silva [this message]
2020-04-27 14:44 ` [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry Josh Poimboeuf
2020-04-27 17:28 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200427133533.GA20830@embeddedor \
--to=gustavo@embeddedor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox