Patchwork [7/8] qemu-ga: Plug fd leak on ga_channel_open() error paths

login
register
mail settings
Submitter Michael Roth
Date Jan. 14, 2013, 7:55 p.m.
Message ID <1358193312-15960-8-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/211899/
State New
Headers show

Comments

Michael Roth - Jan. 14, 2013, 7:55 p.m.
From: Markus Armbruster <armbru@redhat.com>

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/channel-posix.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index 9a5c05d..05e8386 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -154,6 +154,7 @@  static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod
         ret = ga_channel_client_add(c, fd);
         if (ret) {
             g_critical("error adding channel to main loop");
+            close(fd);
             return false;
         }
         break;