v2api/reverse: fix two fd leaks

This commit is contained in:
Jakob Unterwurzacher 2020-08-15 15:28:32 +02:00
parent 35055030a1
commit 1ea1b179c2
2 changed files with 2 additions and 0 deletions

View File

@ -104,6 +104,7 @@ func (n *Node) lookupLongnameName(ctx context.Context, nameFile string, out *fus
errno = fs.ToErrno(err) errno = fs.ToErrno(err)
return return
} }
defer syscall.Close(fd)
diriv := pathiv.Derive(n.Path(), pathiv.PurposeDirIV) diriv := pathiv.Derive(n.Path(), pathiv.PurposeDirIV)
rn := n.rootNode() rn := n.rootNode()
pName, cFullname, errno := rn.findLongnameParent(fd, diriv, nameFile) pName, cFullname, errno := rn.findLongnameParent(fd, diriv, nameFile)

View File

@ -56,6 +56,7 @@ func (rfs *RootNode) rDecryptName(cName string, dirIV []byte, pDir string) (pNam
if err != nil { if err != nil {
return "", err return "", err
} }
defer syscall.Close(fd)
var errno syscall.Errno var errno syscall.Errno
pName, _, errno = rfs.findLongnameParent(fd, dirIV, cName) pName, _, errno = rfs.findLongnameParent(fd, dirIV, cName)
if errno != 0 { if errno != 0 {