[PATCH 1/2] common: elf: use strdup_const for symmetry
Ahmad Fatoum
a.fatoum at barebox.org
Mon Jan 5 00:33:37 PST 2026
The elf->filename is free'd by free_const, but it's always allocated
with strdup. Change this to strdup_const to be able to avoid duplicating
string literals.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
common/elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/elf.c b/common/elf.c
index c68ea0be3fa6..e8126c9b64e7 100644
--- a/common/elf.c
+++ b/common/elf.c
@@ -315,7 +315,7 @@ static struct elf_image *elf_check_init(const char *filename)
}
close(fd);
- elf->filename = strdup(filename);
+ elf->filename = strdup_const(filename);
if (!elf->filename) {
ret = -ENOMEM;
goto err_free_hdr_buf;
--
2.47.3
More information about the barebox
mailing list