diff options
author | Fam Zheng <famz@redhat.com> | 2017-03-15 00:12:05 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-03-17 12:54:06 +0100 |
commit | fed414df9dc9abef040adfbd8c5956fb610edaa2 (patch) | |
tree | 1e7c433cd89cd990c1d7602e9658681579b54d90 /block/file-posix.c | |
parent | 37a9051cc7d30672216af5f6620af1da122f66b3 (diff) |
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 <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/file-posix.c')
-rw-r--r-- | block/file-posix.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 |