[libvirt] [libvirt-glib 3/5] gobject: Fix handle leak on wrapper object creation

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Tue Nov 13 18:17:02 UTC 2012


On Tue, Nov 13, 2012 at 6:30 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> When creating an object wrapping a libvirt object (GVirDomain,
> GVirStoragePool, GVirStorageVol), libvirt-gobject gets a reference
> to a libvirt object to be used as a handle, and then creates the wrapper
> object by calling g_object_new(..., "handle", handle, NULL);
>
> However, the underlying libvirt object is registered as a boxed type
> with the gobject type system, and the handle setter for these object
> calls g_value_dup_boxed, which in turn adds a reference on the libvirt
> handle. Thus we must release the initial ref we hold on the libvirt
> handle after calling g_object_new().

Looks good. ACK.

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the libvir-list mailing list