x86/crossystem_arch: Free file descriptor if we fail to use it

Found by Coverity Scan #204275

BUG=none
BRANCH=none
TEST=Coverity run after this merged marks #204275 fixed

Change-Id: I50e6300eabaf6bd0c1230b0cbd2d375ab1daf5d2
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1827293
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index 3151064..c745e0b 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -245,12 +245,16 @@
 			break;
 
 		rv = fstat(fd, &fs);
-		if (rv || !S_ISREG(fs.st_mode))
+		if (rv || !S_ISREG(fs.st_mode)) {
+			close(fd);
 			break;
+		}
 
 		f = fdopen(fd, "r");
-		if (!f)
+		if (!f) {
+			close(fd);
 			break;
+		}
 
 		file_buffer = malloc(fs.st_size + 1);
 		if (!file_buffer)