lkml.org 
[lkml]   [2022]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] objtool: Fix memory leakage
Date
This commit fixes memory leakage in handle_group_alt() function.

Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
---
tools/objtool/check.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 43ec14c29a60..2689098e9bad 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1569,6 +1569,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;
}

@@ -1603,6 +1604,7 @@ static int handle_group_alt(struct objtool_file *file,
nop = malloc(sizeof(*nop));
if (!nop) {
WARN("malloc failed");
+ free(new_alt_group);
return -1;
}
memset(nop, 0, sizeof(*nop));
--
2.25.1
\
 
 \ /
  Last update: 2022-11-30 03:37    [W:0.033 / U:0.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site