mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:33:23 +00:00
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>
This commit is contained in:
parent
a3ead9fb86
commit
7fe652ab57
1 changed files with 1 additions and 1 deletions
2
file.c
2
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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue