binfmt/builtin.c: Fix a memory leak: File was not being closed.

This commit is contained in:
Bruno Herrera 2015-08-30 07:14:45 -06:00 committed by Gregory Nutt
parent ed750f3600
commit 3fd07e32e9
2 changed files with 6 additions and 0 deletions

View File

@ -10903,3 +10903,6 @@
* include/nuttx/mtd/mtd.h: Move MTD ioctl command definitions from * include/nuttx/mtd/mtd.h: Move MTD ioctl command definitions from
include/nuttx/fs/fs.h to include/nuttx/mtd.h. Add ioctl commands include/nuttx/fs/fs.h to include/nuttx/mtd.h. Add ioctl commands
to protect and unprotect memory (2015-08-29). 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).

View File

@ -116,6 +116,7 @@ static int builtin_loadbinary(struct binary_s *binp)
{ {
int errval = get_errno(); int errval = get_errno();
bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval); bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
close(fd);
return -errval; return -errval;
} }
@ -128,6 +129,7 @@ static int builtin_loadbinary(struct binary_s *binp)
{ {
int errval = get_errno(); int errval = get_errno();
bdbg("ERROR: %s is not a builtin application\n", filename); bdbg("ERROR: %s is not a builtin application\n", filename);
close(fd);
return -errval; return -errval;
} }
@ -140,6 +142,7 @@ static int builtin_loadbinary(struct binary_s *binp)
binp->entrypt = b->main; binp->entrypt = b->main;
binp->stacksize = b->stacksize; binp->stacksize = b->stacksize;
binp->priority = b->priority; binp->priority = b->priority;
close(fd);
return OK; return OK;
} }