diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c index f48b81aed..a2e360f52 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -360,8 +360,10 @@ get_btrfs_fs_prefix (const char *mount_path) ret[1+namelen] = '\0'; } if (!ret) - return xstrdup ("/"); + ret = xstrdup ("/"); + close (fd); return ret; + fail: free (ret); close (fd);