[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <168629685414.404.166550567183252024.tip-bot2@tip-bot2>
Date: Fri, 09 Jun 2023 07:47:34 -0000
From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: objtool/core] objtool: Don't free memory in elf_close()
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 5201a9bcb7d3f98ab99c17325b0aa925c2888ca3
Gitweb: https://git.kernel.org/tip/5201a9bcb7d3f98ab99c17325b0aa925c2888ca3
Author: Josh Poimboeuf <jpoimboe@...nel.org>
AuthorDate: Tue, 30 May 2023 10:21:01 -07:00
Committer: Josh Poimboeuf <jpoimboe@...nel.org>
CommitterDate: Wed, 07 Jun 2023 10:03:19 -07:00
objtool: Don't free memory in elf_close()
It's not necessary, objtool's about to exit anyway.
Link: https://lore.kernel.org/r/74bdb3058b8f029db8d5b3b5175f2a200804196d.1685464332.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
---
tools/objtool/elf.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 8d491b2..8d53f18 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -1350,30 +1350,14 @@ int elf_write(struct elf *elf)
void elf_close(struct elf *elf)
{
- struct section *sec, *tmpsec;
- struct symbol *sym, *tmpsym;
- struct reloc *reloc, *tmpreloc;
-
if (elf->elf)
elf_end(elf->elf);
if (elf->fd > 0)
close(elf->fd);
- list_for_each_entry_safe(sec, tmpsec, &elf->sections, list) {
- list_for_each_entry_safe(sym, tmpsym, &sec->symbol_list, list) {
- list_del(&sym->list);
- hash_del(&sym->hash);
- }
- list_for_each_entry_safe(reloc, tmpreloc, &sec->reloc_list, list) {
- list_del(&reloc->list);
- hash_del(&reloc->hash);
- }
- list_del(&sec->list);
- free(sec->reloc_data);
- }
-
- free(elf->symbol_data);
- free(elf->section_data);
- free(elf);
+ /*
+ * NOTE: All remaining allocations are leaked on purpose. Objtool is
+ * about to exit anyway.
+ */
}
Powered by blists - more mailing lists