From 468e08c1b4ff1441cf898623782869c7daf1c947 Mon Sep 17 00:00:00 2001 From: Liio Chen Date: Tue, 22 Oct 2019 15:08:44 +0800 Subject: [PATCH] binnfmt:Fix return before close ELF fd elf_init open a elf file , if both enabled CONFIG_NSH_BUIlTAPPS and CONFIG_NSH_FILE_APPS , elf_init will read elf file in /bin directory, but that length is zero , elf_read failed return and NOT close elf fd, so this line MUST be return to errout_with_init --- binfmt/elf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/binfmt/elf.c b/binfmt/elf.c index ccf62baf77..cf739557a8 100644 --- a/binfmt/elf.c +++ b/binfmt/elf.c @@ -220,7 +220,7 @@ static int elf_loadbinary(FAR struct binary_s *binp) if (ret != 0) { berr("Failed to initialize for load of ELF program: %d\n", ret); - goto errout; + goto errout_with_init; } /* Load the program binary */ @@ -287,7 +287,6 @@ errout_with_load: elf_unload(&loadinfo); errout_with_init: elf_uninit(&loadinfo); -errout: return ret; }