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

Re: [libvirt] [libvirt-glib] Fix [gs]et_custom_xml-related leaks



Ping?
On Mon, Feb 06, 2012 at 05:07:35PM +0100, Christophe Fergeau wrote:
> I forgot to run the testing code through valgrind before pushing
> the patches so a few small memory leaks crept in.
> ---
>  libvirt-gconfig/libvirt-gconfig-domain.c   |    1 +
>  libvirt-gconfig/tests/test-domain-create.c |    8 ++++++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
> index d7ac4c6..177c926 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain.c
> @@ -479,6 +479,7 @@ gboolean gvir_config_domain_set_custom_xml(GVirConfigDomain *domain,
>      gvir_config_object_delete_children(metadata, NULL, ns_uri);
>      gvir_config_object_attach_add(metadata, custom_xml);
>      g_object_unref(G_OBJECT(metadata));
> +    g_object_unref(G_OBJECT(custom_xml));
>  
>      return TRUE;
>  }
> diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
> index 1610587..821e0b0 100644
> --- a/libvirt-gconfig/tests/test-domain-create.c
> +++ b/libvirt-gconfig/tests/test-domain-create.c
> @@ -177,8 +177,12 @@ int main(int argc, char **argv)
>      gvir_config_domain_set_custom_xml(domain, "<foo/>", "ns", "http://bar";, NULL);
>      gvir_config_domain_set_custom_xml(domain, "<bar/>", "ns", "http://foo";, NULL);
>  
> -    g_assert(g_strcmp0(gvir_config_domain_get_custom_xml(domain, "http://foo";), "<ns:bar xmlns:ns=\"http://foo\"/>") == 0);
> -    g_assert(g_strcmp0(gvir_config_domain_get_custom_xml(domain, "http://bar";), "<ns:foo xmlns:ns=\"http://bar\"/>") == 0);
> +    xml = gvir_config_domain_get_custom_xml(domain, "http://foo";);
> +    g_assert(g_strcmp0(xml, "<ns:bar xmlns:ns=\"http://foo\"/>") == 0);
> +    g_free(xml);
> +    xml = gvir_config_domain_get_custom_xml(domain, "http://bar";);
> +    g_assert(g_strcmp0(xml, "<ns:foo xmlns:ns=\"http://bar\"/>") == 0);
> +    g_free(xml);
>  
>      xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(domain));
>      g_print("%s\n\n", xml);
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpgqTCztfdZi.pgp
Description: PGP signature


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