summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Andrew Clayton <andrew@digital-domain.net>2012-07-12 23:28:47 +0100
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-07-12 18:19:47 -0700
commit7fe652ab5738717ba443ae9de2b8f437103fd71b (patch)
tree707aafc488689dcf882d2942fdbcde7ba1335ab9 /file.c
parenta3ead9fb862207749d23368db9b857559c0dde78 (diff)
downloadsubsurface-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/file.c b/file.c
index 538f5c783..e0163909e 100644
--- a/file.c
+++ b/file.c
@@ -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;