Messages in this thread Patch in this message | | | From | Kuan-Wei Chiu <> | Subject | [PATCH] objtool: Fix memory leak in check.c | Date | Wed, 4 Oct 2023 00:13:35 +0800 |
| |
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
| |