From 85c1354043c66221d0e7b819c44a66e05f0102ad Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 7 May 2021 21:48:02 +0800 Subject: [PATCH] binfmt/elf: Don't close filfd in the fail path to avoid close the same handle twice because the caller also call elf_uninit in this case Signed-off-by: Xiang Xiao Change-Id: Iddcbae9587d11d3b5b06e876d4a037ac0d11992e --- binfmt/libelf/libelf_init.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/binfmt/libelf/libelf_init.c b/binfmt/libelf/libelf_init.c index 7f4ae3c13a6..6658aa0b62b 100644 --- a/binfmt/libelf/libelf_init.c +++ b/binfmt/libelf/libelf_init.c @@ -161,7 +161,6 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo) if (ret < 0) { berr("Failed to read ELF header: %d\n", ret); - nx_close(loadinfo->filfd); return ret; } @@ -181,7 +180,6 @@ int elf_init(FAR const char *filename, FAR struct elf_loadinfo_s *loadinfo) */ berr("Bad ELF header: %d\n", ret); - nx_close(loadinfo->filfd); return ret; }