From e1e6e916cd4d516de3a42e095b7bb1cacae1e882 Mon Sep 17 00:00:00 2001 From: Jeremie Courreges-Anglas Date: Sat, 10 Aug 2013 09:51:51 +0000 Subject: Plug fd and mem leak in fuse_open's error path. ok syl@ --- lib/libfuse/fuse.c | 10 +++++----- 1 file 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 * @@ -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); } -- cgit v1.2.3