summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2013-08-10 09:51:51 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2013-08-10 09:51:51 +0000
commite1e6e916cd4d516de3a42e095b7bb1cacae1e882 (patch)
tree834666a1c26dc30f361086be50836fc680f9cdc0
parente9515236497c0b1504fad76c099b67fb8702d651 (diff)
Plug fd and mem leak in fuse_open's error path. ok syl@
-rw-r--r--lib/libfuse/fuse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c
index 7090239629a..d1ac5b89e8e 100644
--- a/lib/libfuse/fuse.c
+++ b/lib/libfuse/fuse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse.c,v 1.9 2013/08/10 00:30:43 syl Exp $ */
+/* $OpenBSD: fuse.c,v 1.10 2013/08/10 09:51:50 jca Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -111,7 +111,7 @@ fuse_mount(const char *dir, unused struct fuse_args *args)
if (fc->dir == NULL)
goto bad;
- if ((fc->fd = open("/dev/fuse0", O_RDWR)) < 0) {
+ if ((fc->fd = open("/dev/fuse0", O_RDWR)) == -1) {
perror(__func__);
goto bad;
}
@@ -135,10 +135,10 @@ fuse_mount(const char *dir, unused struct fuse_args *args)
return (fc);
bad:
- if (fc->fd > 0)
+ if (fc->fd != -1)
close(fc->fd);
- if (fc->dir != NULL)
- free(fc->dir);
+ free(fc->dir);
+ free(fc);
return (NULL);
}