qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 5/8] qemu-ga: Plug file descriptor leak on ga_open_p


From: Michael Roth
Subject: [Qemu-devel] [PATCH 5/8] qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path
Date: Mon, 14 Jan 2013 13:55:09 -0600

From: Markus Armbruster <address@hidden>

Spotted by Coverity.  Also document why we keep it open on success.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
Reviewed-by: Luiz Capitulino <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
 qga/main.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/qga/main.c b/qga/main.c
index 96d3cfa..db281a5 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -299,10 +299,12 @@ static bool ga_open_pidfile(const char *pidfile)
         goto fail;
     }
 
+    /* keep pidfile open & locked forever */
     return true;
 
 fail:
     unlink(pidfile);
+    close(pidfd);
     return false;
 }
 #else /* _WIN32 */
-- 
1.7.9.5




reply via email to

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