]> git.proxmox.com Git - grub2.git/commitdiff
linux/getroot: fix descriptor leak.
authorAndrei Borzenkov <arvidjaar@gmail.com>
Mon, 26 Jan 2015 18:38:40 +0000 (21:38 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Mon, 26 Jan 2015 20:02:55 +0000 (23:02 +0300)
Found by: Coverity scan.

grub-core/osdep/linux/getroot.c

index f48b81aed228a4cf474b46a73afb11f2d7bc489e..a2e360f52a6c7ca8e866e213668af0db030df76b 100644 (file)
@@ -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);