It's detected by coverity. Close the dirfd.

Signed-off-by: Shannon Zhao <zhaoshengl...@huawei.com>
Signed-off-by: Shannon Zhao <shannon.z...@linaro.org>
---
 qga/commands-posix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index d5bb5cb..cbf1c80 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo 
*qmp_guest_get_memory_block_info(Error **errp)
     ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
     if (local_err) {
         g_free(buf);
+        close(dirfd);
         error_propagate(errp, local_err);
         return NULL;
     }
@@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo 
*qmp_guest_get_memory_block_info(Error **errp)
     info->size = strtol(buf, NULL, 16); /* the unit is bytes */
 
     g_free(buf);
+    close(dirfd);
 
     return info;
 }
-- 
1.8.3.1



Reply via email to