mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: jpoimboe@kernel.org, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: [PATCH] objtool: Fix memory leak in check.c
Date: Wed,  4 Oct 2023 00:13:35 +0800	[thread overview]
Message-ID: <20231003161335.1403094-1-visitorckw@gmail.com> (raw)

In the 'disas_funcs' function of check.c, the 'cmd' string used to store
a command is not being freed after it's used, leading to a memory leak.
This patch adds the necessary 'free(cmd)' statement to release the
allocated memory.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e308d1ba664e..b010b883c1ee 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4589,6 +4589,7 @@ static int disas_funcs(const char *funcs)
 	/* real snprintf() */
 	snprintf(cmd, size, objdump_str, cross_compile, objname, funcs);
 	ret = system(cmd);
+	free(cmd);
 	if (ret) {
 		WARN("disassembly failed: %d", ret);
 		return -1;
-- 
2.25.1


             reply	other threads:[~2023-10-03 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 16:13 Kuan-Wei Chiu [this message]
2023-10-03 16:26 ` Peter Zijlstra

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=20231003161335.1403094-1-visitorckw@gmail.com \
    --to=visitorckw@gmail.com \
    --cc=jpoimboe@kernel.org \
    --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

all inboxes | Powered by JetHome®