[libvirt] [libvirt-glib 23/37] Add test for adding a disk device

Marc-André Lureau marcandre.lureau at gmail.com
Fri Nov 11 18:05:18 UTC 2011


On Thu, Nov 10, 2011 at 9:33 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
>  devices = g_list_append(devices, disk);
> +    gvir_config_domain_set_devices(domain, devices);
> +    g_list_free(devices);
> +    devices = NULL;


Hmm, I realize this is a bit more tricky. You give up devices element
owner ship but no the container.. I think this is bad, as the list
contains invalid objects after leaving the functions. Insead, the
set_devices () function should ref the element, and the caller should
unref too with g_list_free_full (devices, g_object_unref)


-- 
Marc-André Lureau




More information about the libvir-list mailing list