From: Markus Armbruster Date: Fri, 11 Jan 2013 10:24:59 +0000 (+0100) Subject: qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=03ac10f166b790cb66804e512abec6d002cd8481;p=qemu.git qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path Spotted by Coverity. Also document why we keep it open on success. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Michael Roth Reviewed-by: Luiz Capitulino Signed-off-by: Michael Roth --- diff --git a/qga/main.c b/qga/main.c index 96d3cfa381..db281a508b 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 */