From 6704abade6674a91d8c652a7e4596ca3421411b6 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Mon, 26 Jan 2015 21:38:40 +0300 Subject: [PATCH] linux/getroot: fix descriptor leak. Found by: Coverity scan. --- grub-core/osdep/linux/getroot.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c =================================================================== --- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c 2015-09-22 17:10:33.177530851 +0800 +++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c 2015-09-22 17:13:27.269530851 +0800 @@ -368,7 +368,8 @@ ret[1+namelen] = '\0'; } if (!ret) - return xstrdup ("/"); + ret = xstrdup ("/"); + close (fd); return ret; }