]> Git Repo - linux.git/commitdiff
fs/binfmt_elf.c: don't free interpreter's ELF pheaders on common path
authorAlexey Dobriyan <[email protected]>
Tue, 7 Apr 2020 03:11:32 +0000 (20:11 -0700)
committerLinus Torvalds <[email protected]>
Tue, 7 Apr 2020 17:43:44 +0000 (10:43 -0700)
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Link: http://lkml.kernel.org/r/20200219185330.GA4933@avx2
Signed-off-by: Linus Torvalds <[email protected]>
fs/binfmt_elf.c

index a3a9429ef1d2a25fb114da3917ebdb6ba94a3a90..13f25e241ac46cbd2f5ffa23de45e60a035a0c1a 100644 (file)
@@ -1076,6 +1076,7 @@ out_free_interp:
                fput(interpreter);
 
                kfree(interp_elf_ex);
+               kfree(interp_elf_phdata);
        } else {
                elf_entry = e_entry;
                if (BAD_ADDR(elf_entry)) {
@@ -1084,7 +1085,6 @@ out_free_interp:
                }
        }
 
-       kfree(interp_elf_phdata);
        kfree(elf_phdata);
 
        set_binfmt(&elf_format);
This page took 0.06721 seconds and 4 git commands to generate.