[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231003161335.1403094-1-visitorckw@gmail.com>
Date: Wed, 4 Oct 2023 00:13:35 +0800
From: Kuan-Wei Chiu <visitorckw@...il.com>
To: jpoimboe@...nel.org, peterz@...radead.org
Cc: linux-kernel@...r.kernel.org, Kuan-Wei Chiu <visitorckw@...il.com>
Subject: [PATCH] objtool: Fix memory leak in check.c
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@...il.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
Powered by blists - more mailing lists