[PATCH 3/3] ELF: don't free interpreter's ELF pheaders on common path
From: Alexey Dobriyan
Date: Wed Feb 19 2020 - 13:53:38 EST
Static executables don't need to free NULL pointer.
It doesn't matter really because static executable is not common
scenario but do it anyway out of pedantry.
Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
---
fs/binfmt_elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1075,6 +1075,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
fput(interpreter);
kfree(interp_elf_ex);
+ kfree(interp_elf_phdata);
} else {
elf_entry = e_entry;
if (BAD_ADDR(elf_entry)) {
@@ -1083,7 +1084,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
}
}
- kfree(interp_elf_phdata);
kfree(elf_phdata);
set_binfmt(&elf_format);