From: Fam Zheng <f...@redhat.com> This fixes a leaked fd introduced in commit 9103f1ce.
Signed-off-by: Fam Zheng <f...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> Signed-off-by: Kevin Wolf <kw...@redhat.com> --- block/file-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index ac6bd9f..53febd3 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -703,6 +703,9 @@ static int hdev_get_max_segments(const struct stat *st) } out: + if (fd != -1) { + close(fd); + } g_free(sysfspath); return ret; #else -- 1.8.3.1