From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuqCo-0001Uo-Pj for qemu-devel@nongnu.org; Mon, 14 Jan 2013 15:00:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuqCj-0008Q6-F2 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 15:00:26 -0500 Received: from mail-ie0-f176.google.com ([209.85.223.176]:36919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuqCj-0008Pn-9i for qemu-devel@nongnu.org; Mon, 14 Jan 2013 15:00:21 -0500 Received: by mail-ie0-f176.google.com with SMTP id 13so5715383iea.21 for ; Mon, 14 Jan 2013 12:00:20 -0800 (PST) Sender: fluxion From: Michael Roth Date: Mon, 14 Jan 2013 13:55:09 -0600 Message-Id: <1358193312-15960-6-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1358193312-15960-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1358193312-15960-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 5/8] qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, armbru@redhat.com, lcapitulino@redhat.com From: Markus Armbruster 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 --- 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