Re: [libvirt-glib 3/3] glib: Don't leak GIOChannel when destroying IO handle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 28, 2014 at 02:08:28PM +0100, Christophe Fergeau wrote:
> gvir_event_handle_add() creates a GIOChannel in order to watch the fd it
> was given for changes.
> gvir_event_handle_remove() is freeing all the resources allocated by
> gvir_event_handle_add() except for this GIOChannel. This commit adds
> the needed g_io_channel_unref() call to gvir_event_handle_remove()
> ---
>  libvirt-glib/libvirt-glib-event.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libvirt-glib/libvirt-glib-event.c b/libvirt-glib/libvirt-glib-event.c
> index adcc2fe..f8227d6 100644
> --- a/libvirt-glib/libvirt-glib-event.c
> +++ b/libvirt-glib/libvirt-glib-event.c
> @@ -298,6 +298,10 @@ gvir_event_handle_remove(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 before it's fully deleted, that's why we need to mark it as
>       * 'removed' to prevent reuse

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]