From: Fam Zheng Date: Tue, 14 Mar 2017 16:12:05 +0000 (+0800) Subject: file-posix: Don't leak fd in hdev_get_max_segments X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=fed414df9dc9abef040adfbd8c5956fb610edaa2;p=qemu.git file-posix: Don't leak fd in hdev_get_max_segments This fixes a leaked fd introduced in commit 9103f1ce. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- diff --git a/block/file-posix.c b/block/file-posix.c index ac6bd9fae8..53febd3767 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