mirror of https://gitee.com/openkylin/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 <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
37a9051cc7
commit
fed414df9d
|
@ -703,6 +703,9 @@ static int hdev_get_max_segments(const struct stat *st)
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (fd != -1) {
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
g_free(sysfspath);
|
g_free(sysfspath);
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue