From edb0a61be4030cc6bdc605332204bb27c9f1b98f Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sun, 3 Aug 2014 12:10:53 +0200 Subject: nvramtool: Close file after use mmap builds a new reference to the file, so the file descriptor isn't necessary anymore. Close it. Change-Id: I639fd13ff8f13cbdfce1d199d75744e56f2b19b3 Found-by: Coverity Scan Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/6475 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Paul Menzel --- util/nvramtool/cbfs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'util/nvramtool') diff --git a/util/nvramtool/cbfs.c b/util/nvramtool/cbfs.c index febe0bed07..abd40eec12 100644 --- a/util/nvramtool/cbfs.c +++ b/util/nvramtool/cbfs.c @@ -144,6 +144,7 @@ void open_cbfs(const char *filename) } cbfs_mapped = mmap(NULL, cbfs_stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, cbfs_fd, 0); + close(cbfs_fd); if (cbfs_mapped == MAP_FAILED) { printf("Couldn't map '%s'\n", filename); exit(-1); -- cgit v1.2.3