[virt-tools-list] [virt-viewer][PATCH] events: Don't leak GIOChannel when destroying IO handle

Christophe Fergeau cfergeau at redhat.com
Fri Jul 17 16:39:31 UTC 2015


ACK.

On Fri, Jul 17, 2015 at 06:33:51PM +0200, Fabiano Fidêncio wrote:
> virt_viewer_events_add_handle() creates a GIOChannel in order to watch
> the fd it was given for changes.
> virt_viewer_events_remove_handle() is freeing all the resources
> allocated by virt_viewer_events_add_handle() expect for this GIOChannel.
> This commit adds the needed g_io_channel_unref() call to
> virt_viewer_events_remove_handle().
> 
> Based on
> http://libvirt.org/git/?p=libvirt-glib.git;a=commit;h=8e95b8d25a3eee6316aff2f83b0c449aaf10984a
> 
> Related to: rhbz#1243228
> ---
>  src/virt-viewer-events.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/virt-viewer-events.c b/src/virt-viewer-events.c
> index d36dd3a..6cdc56a 100644
> --- a/src/virt-viewer-events.c
> +++ b/src/virt-viewer-events.c
> @@ -239,6 +239,10 @@ virt_viewer_events_remove_handle(int watch)
>          data->events = 0;
>      }
>  
> +    g_warn_if_fail(data->channel != NULL);
> +    g_io_channel_unref(data->channel);
> +    data->channel = NULL;
> +
>      /* since the actual watch deletion is done asynchronously, a handle_update call may
>       * reschedule the watch befure it's fully deleted, that's why we need to mar it as
>       * 'removed' to prevent reuse
> -- 
> 2.4.4
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20150717/e9e1061a/attachment.sig>


More information about the virt-tools-list mailing list