linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] objtool: Fix a memory leak bug
@ 2021-03-09  8:46 Jiapeng Chong
  2021-03-09 15:34 ` Josh Poimboeuf
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-03-09  8:46 UTC (permalink / raw)
  To: jpoimboe
  Cc: peterz, nathan, ndesaulniers, linux-kernel, clang-built-linux,
	Jiapeng Chong

Fix the following cppcheck warnings:

tools/objtool/check.c(1102): error: Memory leak: orig_alt_group.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/objtool/check.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 068cdb4..bfa7c31 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1099,6 +1099,7 @@ static int handle_group_alt(struct objtool_file *file,
 				     sizeof(struct cfi_state *));
 	if (!orig_alt_group->cfi) {
 		WARN("calloc failed");
+		free(orig_alt_group);
 		return -1;
 	}
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] objtool: Fix a memory leak bug
  2021-03-09  8:46 [PATCH] objtool: Fix a memory leak bug Jiapeng Chong
@ 2021-03-09 15:34 ` Josh Poimboeuf
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Poimboeuf @ 2021-03-09 15:34 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: peterz, nathan, ndesaulniers, linux-kernel, clang-built-linux

On Tue, Mar 09, 2021 at 04:46:16PM +0800, Jiapeng Chong wrote:
> Fix the following cppcheck warnings:
> 
> tools/objtool/check.c(1102): error: Memory leak: orig_alt_group.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Hi Jiapeng,

Objtool is a short-running process which exits immediately on error, so
we don't worry about memory leaks.

-- 
Josh


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-09 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  8:46 [PATCH] objtool: Fix a memory leak bug Jiapeng Chong
2021-03-09 15:34 ` Josh Poimboeuf

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).