linux/getroot: fix descriptor leak.

Found by: Coverity scan.
This commit is contained in:
Andrei Borzenkov committed 2015-01-26 23:02:55 +03:00
1 parent 11eed6abce
commit 6704abade6
1 file changed
+3 -1
+3 -1
View 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);