aboutsummaryrefslogtreecommitdiff
path: root/qga/commands-posix.c
diff options
context:
space:
mode:
authorShannon Zhao <zhaoshenglong@huawei.com>2015-03-14 17:52:15 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2015-03-19 11:39:18 +0300
commit8ce1ee4618f4a557959f5a5731f6726b30416df5 (patch)
treea64820a1ff0499b150b552b6f66f24319170d564 /qga/commands-posix.c
parent23bf2e76806390bf12798c2234a23c5c8a15c35d (diff)
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>
Diffstat (limited to 'qga/commands-posix.c')
-rw-r--r--qga/commands-posix.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index d5bb5cb5da..ba8de62436 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -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);