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
1 changed files with 3 additions and 1 deletions

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);