[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200622020434.18159-1-gaurav1086@gmail.com>
Date: Sun, 21 Jun 2020 22:04:34 -0400
From: Gaurav Singh <gaurav1086@...il.com>
To: gaurav1086@...il.com, Josh Poimboeuf <jpoimboe@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] [objtoo] fix memory leak in special_get_alts
Free alt before returning to avoid memory leak.
Signed-off-by: Gaurav Singh <gaurav1086@...il.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 e74e0189de22..f6f7dee1ba77 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