mirror of https://gitee.com/openkylin/qemu.git
qga/commands-posix: Fix resource leak
It's detected by coverity. Close the dirfd. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
23bf2e7680
commit
8ce1ee4618
|
@ -2283,6 +2283,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
|
|||
|
||||
buf = g_malloc0(20);
|
||||
ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
|
||||
close(dirfd);
|
||||
if (local_err) {
|
||||
g_free(buf);
|
||||
error_propagate(errp, local_err);
|
||||
|
|
Loading…
Reference in New Issue