* [PATCH] [objtoo] fix memory leak in special_get_alts
@ 2020-06-22 2:04 Gaurav Singh
2020-06-22 22:48 ` Josh Poimboeuf
0 siblings, 1 reply; 2+ messages in thread
From: Gaurav Singh @ 2020-06-22 2:04 UTC (permalink / raw)
To: gaurav1086, Josh Poimboeuf, Peter Zijlstra, open list
Free alt before returning to avoid memory leak.
Signed-off-by: Gaurav Singh <gaurav1086@gmail.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [objtoo] fix memory leak in special_get_alts
2020-06-22 2:04 [PATCH] [objtoo] fix memory leak in special_get_alts Gaurav Singh
@ 2020-06-22 22:48 ` Josh Poimboeuf
0 siblings, 0 replies; 2+ messages in thread
From: Josh Poimboeuf @ 2020-06-22 22:48 UTC (permalink / raw)
To: Gaurav Singh; +Cc: Peter Zijlstra, open list
On Sun, Jun 21, 2020 at 10:04:34PM -0400, Gaurav Singh wrote:
> Free alt before returning to avoid memory leak.
>
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Hi Gaurav,
Since objtool is a short-lived (and performance sensitive) process, we
don't care about memory leaks. In fact we intentionally don't fix them.
--
Josh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-22 22:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 2:04 [PATCH] [objtoo] fix memory leak in special_get_alts Gaurav Singh
2020-06-22 22:48 ` 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).