linux/getroot: fix descriptor leak.

Found by: Coverity scan.
This commit is contained in:
Andrei Borzenkov 2015-01-26 21:38:40 +03:00
parent 11eed6abce
commit 6704abade6

View file

@ -360,8 +360,10 @@ get_btrfs_fs_prefix (const char *mount_path)
ret[1+namelen] = '\0'; ret[1+namelen] = '\0';
} }
if (!ret) if (!ret)
return xstrdup ("/"); ret = xstrdup ("/");
close (fd);
return ret; return ret;
fail: fail:
free (ret); free (ret);
close (fd); close (fd);