diff options
author | Andrew Clayton <andrew@digital-domain.net> | 2012-07-12 23:28:47 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-12 18:19:47 -0700 |
commit | 7fe652ab5738717ba443ae9de2b8f437103fd71b (patch) | |
tree | 707aafc488689dcf882d2942fdbcde7ba1335ab9 /file.c | |
parent | a3ead9fb862207749d23368db9b857559c0dde78 (diff) | |
download | subsurface-7fe652ab5738717ba443ae9de2b8f437103fd71b.tar.gz |
file.c: Fix a file descriptor leak in readfile()
In file.c::readfile() the file was being opened once at fd declaration
time and then again a few lines later and only being closed once. Remove
the open() at fd declaration time leaving the later one where the fd check
is done.
Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -10,7 +10,7 @@ static int readfile(const char *filename, struct memblock *mem) { - int ret, fd = open(filename, O_RDONLY); + int ret, fd; struct stat st; char *buf; |