Blame SOURCES/0004-efi_loadopt_args_from_file-fix-leaked-file-descripto.patch

ac385c
From 0967cd89ae6c1e55c1d136669e2f426752f233f4 Mon Sep 17 00:00:00 2001
ac385c
From: Peter Jones <pjones@redhat.com>
ac385c
Date: Mon, 1 May 2017 14:40:26 -0400
ac385c
Subject: [PATCH 04/22] efi_loadopt_args_from_file(): fix leaked file
ac385c
 descriptor.
ac385c
ac385c
In the case where we're just trying to figure out the file's size, we're
ac385c
failing to close the file.  So close it.
ac385c
ac385c
Found by covscan.
ac385c
ac385c
Signed-off-by: Peter Jones <pjones@redhat.com>
ac385c
---
ac385c
 src/loadopt.c | 4 +++-
ac385c
 1 file changed, 3 insertions(+), 1 deletion(-)
ac385c
ac385c
diff --git a/src/loadopt.c b/src/loadopt.c
ac385c
index ce88986..a3c1ba9 100644
ac385c
--- a/src/loadopt.c
ac385c
+++ b/src/loadopt.c
ac385c
@@ -275,8 +275,10 @@ efi_loadopt_args_from_file(uint8_t *buf, ssize_t size, char *filename)
ac385c
 	if (rc < 0)
ac385c
 		goto err;
ac385c
 
ac385c
-	if (size == 0)
ac385c
+	if (size == 0) {
ac385c
+		fclose(f);
ac385c
 		return statbuf.st_size;
ac385c
+	}
ac385c
 
ac385c
 	if (size < statbuf.st_size) {
ac385c
 		errno = ENOSPC;
ac385c
-- 
ac385c
2.12.2
ac385c