[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH v2] qga/commands-posix: Fix resource leak

From: Shannon Zhao
Subject: [Qemu-trivial] [PATCH v2] qga/commands-posix: Fix resource leak
Date: Sat, 14 Mar 2015 17:52:15 +0800

It's detected by coverity. Close the dirfd.

Signed-off-by: Shannon Zhao <address@hidden>
Signed-off-by: Shannon Zhao <address@hidden>
    v1->v2: close after use [Stefan Weil]
 qga/commands-posix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index d5bb5cb..ba8de62 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) {
         error_propagate(errp, local_err);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]