grub2/0260-linux-ofpath-fix-descriptor-leak.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

27 lines
777 B
Diff

From 637fc62699e7ae3f0057e1c56d330eb193fd40b6 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Tue, 27 Jan 2015 20:29:00 +0300
Subject: [PATCH 260/506] linux/ofpath: fix descriptor leak
Found by: Coverity scan
---
grub-core/osdep/linux/ofpath.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
index f716fd2..05b1ecd 100644
--- a/grub-core/osdep/linux/ofpath.c
+++ b/grub-core/osdep/linux/ofpath.c
@@ -122,6 +122,8 @@ find_obppath (const char *sysfs_path_orig)
fd = open(path, O_RDONLY);
if (fd < 0 || fstat (fd, &st) < 0)
{
+ if (fd >= 0)
+ close (fd);
snprintf(path, path_size, "%s/devspec", sysfs_path);
fd = open(path, O_RDONLY);
}
--
2.4.3