diff mbox

[4/6] qemu-ga: Plug fd leak on ga_channel_listen_accept() error path

Message ID 1357899902-5316-5-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Jan. 11, 2013, 10:25 a.m. UTC
Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qga/channel-posix.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Roth Jan. 11, 2013, 5:44 p.m. UTC | #1
On Fri, Jan 11, 2013 at 11:25:00AM +0100, Markus Armbruster wrote:
> Spotted by Coverity.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>

> ---
>  qga/channel-posix.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/qga/channel-posix.c b/qga/channel-posix.c
> index d4fd628..5579185 100644
> --- a/qga/channel-posix.c
> +++ b/qga/channel-posix.c
> @@ -45,6 +45,7 @@ static gboolean ga_channel_listen_accept(GIOChannel *channel,
>      ret = ga_channel_client_add(c, client_fd);
>      if (ret) {
>          g_warning("error setting up connection");
> +        close(client_fd);
>          goto out;
>      }
>      accepted = true;
> -- 
> 1.7.11.7
>
diff mbox

Patch

diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index d4fd628..5579185 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -45,6 +45,7 @@  static gboolean ga_channel_listen_accept(GIOChannel *channel,
     ret = ga_channel_client_add(c, client_fd);
     if (ret) {
         g_warning("error setting up connection");
+        close(client_fd);
         goto out;
     }
     accepted = true;