From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnoiv-0001Dl-4Y for qemu-devel@nongnu.org; Tue, 14 Mar 2017 11:50:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnoiu-0008Le-4P for qemu-devel@nongnu.org; Tue, 14 Mar 2017 11:50:57 -0400 Date: Tue, 14 Mar 2017 16:50:46 +0100 From: Kevin Wolf Message-ID: <20170314155046.GL3952@noname.str.redhat.com> References: <20170314154315.17869-1-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170314154315.17869-1-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] file-posix: Don't leak fd in hdev_get_max_segments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, Paolo Bonzini , Max Reitz , qemu-block@nongnu.org Am 14.03.2017 um 16:43 hat Fam Zheng geschrieben: > Signed-off-by: Fam Zheng > --- > block/file-posix.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/file-posix.c b/block/file-posix.c > index c4c0663..e6170f4 100644 > --- a/block/file-posix.c > +++ b/block/file-posix.c > @@ -703,6 +703,7 @@ static int hdev_get_max_segments(const struct stat *st) > } > > out: > + close(fd); Should we make this conditional on fd != -1? > g_free(sysfspath); > return ret; > #else Kevin