diff --git a/ChangeLog b/ChangeLog index fc2b2decd2..6f6479b67b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10903,3 +10903,6 @@ * include/nuttx/mtd/mtd.h: Move MTD ioctl command definitions from include/nuttx/fs/fs.h to include/nuttx/mtd.h. Add ioctl commands to protect and unprotect memory (2015-08-29). + * binfmt/builtin.c: Fix a memory leak: File was not being closed. + From Bruno Herrera (2015-08-30). + diff --git a/binfmt/builtin.c b/binfmt/builtin.c index 4e6b18c9c4..537556136b 100644 --- a/binfmt/builtin.c +++ b/binfmt/builtin.c @@ -116,6 +116,7 @@ static int builtin_loadbinary(struct binary_s *binp) { int errval = get_errno(); bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval); + close(fd); return -errval; } @@ -128,6 +129,7 @@ static int builtin_loadbinary(struct binary_s *binp) { int errval = get_errno(); bdbg("ERROR: %s is not a builtin application\n", filename); + close(fd); return -errval; } @@ -140,6 +142,7 @@ static int builtin_loadbinary(struct binary_s *binp) binp->entrypt = b->main; binp->stacksize = b->stacksize; binp->priority = b->priority; + close(fd); return OK; }