[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH] file-posix: Don't leak fd in hdev_get_max_segme
From: |
Fam Zheng |
Subject: |
Re: [Qemu-block] [PATCH] file-posix: Don't leak fd in hdev_get_max_segments |
Date: |
Wed, 15 Mar 2017 00:11:24 +0800 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Tue, 03/14 16:50, Kevin Wolf wrote:
> Am 14.03.2017 um 16:43 hat Fam Zheng geschrieben:
> > Signed-off-by: Fam Zheng <address@hidden>
> > ---
> > 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?
OK, that is cleaner.
Fam
>
> > g_free(sysfspath);
> > return ret;
> > #else
>
> Kevin