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 <[email protected]>
---
 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


Reply via email to