summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-01-02 00:14:12 +0100
committerJakob Unterwurzacher2019-01-02 00:14:12 +0100
commit5aa1755cbc55d17a5b4b71faa1e0bba34fe83d8b (patch)
tree1e5bc3b9f29e97357f1d96c2426dda6641e7119a
parentd99a0480f712d4fd1c2012c57a9e1c938d70c9fe (diff)
fusefrontend: openBackingDir: fix fd leak in error path
Reported by @slackner at https://github.com/rfjakob/gocryptfs/commit/932efbd4593fe6be6c86f0dafeaea32910b7c246#r31813373 thanks!
-rw-r--r--internal/fusefrontend/names.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/fusefrontend/names.go b/internal/fusefrontend/names.go
index a6791cc..36185e2 100644
--- a/internal/fusefrontend/names.go
+++ b/internal/fusefrontend/names.go
@@ -65,6 +65,7 @@ func (fs *FS) openBackingDir(relPath string) (dirfd int, cName string, err error
for i, name := range parts {
iv, err := nametransform.ReadDirIVAt(dirfd)
if err != nil {
+ syscall.Close(dirfd)
return -1, "", err
}
cName = fs.nameTransform.EncryptAndHashName(name, iv)