[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200702110025.16883-1-chenwandun@huawei.com>
Date: Thu, 2 Jul 2020 19:00:25 +0800
From: Chen Wandun <chenwandun@...wei.com>
To: <jpoimboe@...hat.com>, <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>
CC: <chenwandun@...wei.com>
Subject: [PATCH] objtool: fix potential memory leak special_get_alts()
If get_alt_entry() return error, struct special_alt will leak.
Fixes: 442f04c34a1a ("objtool: Add tool to perform compile-time stack metadata validation")
Signed-off-by: Chen Wandun <chenwandun@...wei.com>
---
tools/objtool/special.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/special.c b/tools/objtool/special.c
index e893f1e48e44..90a6ba2d5895 100644
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -188,8 +188,10 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
memset(alt, 0, sizeof(*alt));
ret = get_alt_entry(elf, entry, sec, idx, alt);
- if (ret)
+ if (ret) {
+ free(alt);
return ret;
+ }
list_add_tail(&alt->list, alts);
}
--
2.17.1
Powered by blists - more mailing lists