You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2021/05/13 04:09:44 UTC

[incubator-nuttx] branch master updated: binfmt/elf: Don't close filfd in the fail path

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 85c1354  binfmt/elf: Don't close filfd in the fail path
85c1354 is described below

commit 85c1354043c66221d0e7b819c44a66e05f0102ad
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri May 7 21:48:02 2021 +0800

    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 <xi...@xiaomi.com>
    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 7f4ae3c..6658aa0 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;
     }