linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Martin Kepplinger <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, martink@posteo.de, tglx@linutronix.de,
	hpa@zytor.com, torvalds@linux-foundation.org,
	linux-kernel@vger.kernel.org, dzickus@redhat.com,
	mingo@kernel.org, jpoimboe@redhat.com
Subject: [tip:core/urgent] tools/objtool: Fix memory leak in elf_create_rela_section()
Date: Thu, 14 Sep 2017 07:06:58 -0700	[thread overview]
Message-ID: <tip-5d0be52d44e32ae98b1345e9ecfa6a97783ca2c9@git.kernel.org> (raw)
In-Reply-To: <20170914060138.26472-1-martink@posteo.de>

Commit-ID:  5d0be52d44e32ae98b1345e9ecfa6a97783ca2c9
Gitweb:     http://git.kernel.org/tip/5d0be52d44e32ae98b1345e9ecfa6a97783ca2c9
Author:     Martin Kepplinger <martink@posteo.de>
AuthorDate: Thu, 14 Sep 2017 08:01:38 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Sep 2017 16:02:30 +0200

tools/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 <martink@posteo.de>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: mingo.kernel.org@gmail.com
Link: http://lkml.kernel.org/r/20170914060138.26472-1-martink@posteo.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 tools/objtool/elf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 6e9f980..1e89a5f 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -508,6 +508,7 @@ struct section *elf_create_rela_section(struct elf *elf, struct section *base)
 	strcat(relaname, base->name);
 
 	sec = elf_create_section(elf, relaname, sizeof(GElf_Rela), 0);
+	free(relaname);
 	if (!sec)
 		return NULL;
 

  parent reply	other threads:[~2017-09-14 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 22:41 [PATCH] tools: objtool: fix memory leak in elf_create_rela_section() Josh Poimboeuf
2017-09-14  5:31 ` Ingo Molnar
2017-09-14  6:01   ` [PATCH v2] " Martin Kepplinger
2017-09-14 12:50     ` Josh Poimboeuf
2017-09-14 14:06     ` tip-bot for Martin Kepplinger [this message]
2017-09-15  8:43     ` [tip:core/urgent] tools/objtool: Fix " tip-bot for Martin Kepplinger
2017-09-15  9:36     ` [tip:core/urgent] objtool: " tip-bot for Martin Kepplinger

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=tip-5d0be52d44e32ae98b1345e9ecfa6a97783ca2c9@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=dzickus@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).